Changeset 2097 for lang/perl/Class-Hookable
- Timestamp:
- 11/28/07 11:08:33 (14 months ago)
- Location:
- lang/perl/Class-Hookable/trunk
- Files:
-
- 1 added
- 1 modified
-
lib/Class/Hookable.pm (modified) (4 diffs)
-
t/01_filter/01_hookable_filter_perfix.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Class-Hookable/trunk/lib/Class/Hookable.pm
r2020 r2097 56 56 57 57 while ( my ( $method, $filter ) = splice @filters, 0, 2 ) { 58 Carp::croak "Invalid filter name. you can use [a-zA-Z_]" 59 if ( $method =~ m{[^a-zA-Z_]} ); 60 58 61 Carp::croak "filter is not CODE reference." 59 62 if ( ref $filter ne 'CODE' ); … … 62 65 } 63 66 67 } 68 69 sub hookable_filter_prefix { 70 my $self = shift; 71 72 if ( @_ ) { 73 my $prefix = shift; 74 Carp::croak "Invalid filter prefix. you can use [a-zA-Z_]" 75 if ( $prefix =~ m{[^a-zA-Z_]} ); 76 $self->hookable_stash->{'filter_prefix'} = $prefix; 77 } 78 else { 79 return $self->hookable_stash->{'filter_prefix'}; 80 } 64 81 } 65 82 … … 443 460 444 461 $hook->hookable_set_filter( 445 run_hook => \&myfilter, 462 register_hook => \&filterA 463 run_hook => \&filterB, 446 464 ); 447 465 448 466 This method registers the filter of hook and method. 467 468 Arguments are specified by the order of C<'name' =E<gt> \&filter>. 469 The character which can be used for the filter name is C<[a-zA-Z_]>. 449 470 450 471 When registering a homonymous filter of the filter registered already, … … 466 487 467 488 =back 489 490 =head2 hookable_filter_prefix 491 492 $hook->hookable_filter_prefix('myfilter_prefix'); 493 494 This method is accessor of filter prefix; 495 496 When finding filter in call_filer_method, 497 prefix specified by this method is used. 498 499 The character which can be used for the filter prefix is C<[a-zA-Z_]>. 468 500 469 501 =head1 UTILITY METHODS
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)