Changeset 9563
- Timestamp:
- 04/16/08 17:14:09 (5 years ago)
- Location:
- lang/perl/Class-Hookable/trunk
- Files:
-
- 1 added
- 1 modified
-
lib/Class/Hookable.pm (modified) (3 diffs)
-
t/40_utility/21_clear_methods.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Class-Hookable/trunk/lib/Class/Hookable.pm
r8907 r9563 357 357 } 358 358 359 sub clear_methods { 360 my ( $self, @methods ) = @_; 361 @methods = $self->registered_methods if ( scalar @methods <= 0 ); 362 363 my $removed = {}; 364 for my $method ( @methods ) { 365 next if ( ! exists $self->class_hookable_methods->{$method} ); 366 $removed->{$method} = delete $self->class_hookable_methods->{$method}; 367 } 368 369 return $removed; 370 } 371 359 372 sub run_hook { 360 373 my ( $self, $hook, $args, $once, $callback ) = @_; … … 1148 1161 1149 1162 When arguments were specified, all plugin registered with specified hooks are deleted, 1150 and when arguments are not specified, a plugin isdeleted from all hooks.1163 and when arguments are not specified, all plugins are deleted from all hooks. 1151 1164 1152 1165 A return value of this method is such feeling: … … 1168 1181 =head2 clear_methods 1169 1182 1183 # clear 'method.A' and 'methodB' 1184 $hook->clear_methods(qw( method.A method.B )); 1185 1186 # clear all 1187 $hook->clear_methods; 1188 1189 my $removed = $hook->clear_methods; 1190 1191 This method deletes all registered method. 1192 1193 An deleted method name is specified as an argument. 1194 1195 When arguments were specified, a plugin registered with specified method is deleted, 1196 and when arguments are not specified, all plugins are deleted from all methods. 1197 1198 A return value of this method is such feeling: 1199 1200 $removed = { 1201 'method.A' => { plugin => $pluginA, function => $pluginA->can('foo') }, 1202 'method.B' => { plugin => $pluginB, function => %pluginB->can('bar') }, 1203 ... 1204 }; 1205 1170 1206 =head1 ACCESSOR METOHDS 1171 1207
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)