Changeset 1177
- Timestamp:
- 07/28/06 11:54:17
- Files:
-
- trunk/plagger/Makefile.PL (modified) (1 diff)
- trunk/plagger/lib/Plagger.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Search/KinoSearch.pm (added)
- trunk/plagger/t/plugins/Search-KinoSearch (added)
- trunk/plagger/t/plugins/Search-KinoSearch/search.t (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/Makefile.PL
r1173 r1177 231 231 recommends('Text::WrapI18N'), 232 232 ], 233 'Search::KinoSearch' => [ 234 -default => 0, 235 recommends('KinoSearch'), 236 ], 233 237 ); 234 238 trunk/plagger/lib/Plagger.pm
r1173 r1177 284 284 285 285 sub run_hook { 286 my($self, $hook, $args, $once) = @_; 286 my($self, $hook, $args, $once, $callback) = @_; 287 288 my @ret; 287 289 for my $action (@{ $self->{hooks}->{$hook} }) { 288 290 my $plugin = $action->{plugin}; 289 291 if ( $plugin->rule->dispatch($plugin, $hook, $args) ) { 290 my $done = $action->{callback}->($plugin, $self, $args); 291 return 1 if $once && $done; 292 } 293 } 294 295 # if $once is set, here means not executed = fail 296 return if $once; 292 my $ret = $action->{callback}->($plugin, $self, $args); 293 push @ret, $ret; 294 if ($callback) { 295 $callback->($ret); 296 } 297 return $ret if $once; 298 } else { 299 push @ret, undef; 300 } 301 } 302 303 return @ret; 297 304 } 298 305 299 306 sub run_hook_once { 300 my($self, $hook, $args ) = @_;301 $self->run_hook($hook, $args, 1 );307 my($self, $hook, $args, $callback) = @_; 308 $self->run_hook($hook, $args, 1, $callback); 302 309 } 303 310
