Changeset 3205 for lang/perl/Class-Hookable
- Timestamp:
- 12/17/07 14:34:39 (13 months ago)
- Location:
- lang/perl/Class-Hookable/trunk
- Files:
-
- 1 added
- 1 modified
-
lib/Class/Hookable.pm (modified) (5 diffs)
-
t/03_utility/13_delete_function.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Class-Hookable/trunk/lib/Class/Hookable.pm
r2980 r3205 275 275 } 276 276 277 sub delete_function { 278 my ( $self, $function, @methods ) = @_; 279 280 Carp::croak "Function is not CODE reference." 281 if ( ref $function ne 'CODE' ); 282 283 @methods = $self->registered_methods 284 if ( @methods == 0 ); 285 286 for my $method ( @methods ) { 287 my $action = $self->registered_function( $method ); 288 if ( $action->{'function'} eq $function ) { 289 $self->delete_method( $method ); 290 } 291 } 292 } 293 277 294 sub delete_plugin { 278 295 my ( $self, $object, @hooks ) = @_; … … 369 386 I thank Tatsuhiko Miyagawa and Plagger contributors. 370 387 388 B<NOTE>: 389 390 Class::Hookable is having substantial changes from version 0.02 to version0.03. 391 When using Class::Hookable, please be careful. 392 393 Please see Changes file about a change point. 394 371 395 =head1 BASIC METHOD 372 396 … … 731 755 and some hook names are specified after that. 732 756 733 When specifying a callback as an argument,757 When specifying only a callback as an argument, 734 758 all callbacks registered with the hook are deleted. 735 759 … … 743 767 This method deleted a registered hookable method. 744 768 The method name is specified as an argument. 769 770 =head2 delete_function 771 772 $hook->delete_function( $plugin->can('function') );: 773 $hook->delete_function( \&function => qw( method.A method.B ) ); 774 775 This method deletes a registered function. 776 777 Function (CODE reference) is specified as the first argument. 778 and some method names are specified after that. 779 780 When specifying only a function as an argument, 781 all functions registered with the method are deleted. 782 783 And when specifying function and method names as arguments, 784 specified functions are deleted from specified methods. 745 785 746 786 =head2 delete_plugin … … 795 835 all method of Class::Hookable is accessing hooks through this method. 796 836 797 =head 1hookable_all_methods837 =head2 hookable_all_methods 798 838 799 839 my $methods = $hook->hookable_all_methods;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)