Changeset 844

Show
Ignore:
Timestamp:
02/15/03 01:04:37
Author:
miyagawa
Message:

applied patch from Tim

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Class-Trigger/trunk/Changes

    r791 r844  
    11Revision history for Perl extension Class::Trigger. 
     2 
     30.07  Sat Feb 15 01:01:36 JST 2003 
     4        - s/add_hook/add_trigger/ in pod. 
     5          (Thanks to Tony Bowden) 
     6        * now you can pass @args to call_trigger 
     7        - Class->call_trigger() works 
     8          (Thanks to Tim Bunce) 
    29 
    3100.06  Wed Oct 23 19:13:20 JST 2002 
  • Class-Trigger/trunk/lib/Class/Trigger.pm

    r791 r844  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.06
     5$VERSION = 0.07
    66 
    77use Class::Data::Inheritable; 
     
    4545 
    4646sub call_trigger { 
    47     my($self, $when) = @_; 
    48     __validate_triggerpoint(ref $self, $when); 
     47    my($self, $when, @args) = @_; 
     48    __validate_triggerpoint(ref($self) || $self, $when); 
    4949    my $all_triggers = __fetch_triggers($self); 
    5050    my $triggers = $all_triggers->{$when} || []; 
    5151    for my $trigger (@{$triggers}) { 
    52         $trigger->($self); 
     52        $trigger->($self, @args); 
    5353    } 
    5454} 
     
    127127 
    128128  # triggers can be object based 
    129   $foo->add_hook(after_foo => \&sub3); 
     129  $foo->add_trigger(after_foo => \&sub3); 
    130130  $foo->foo;                    # sub3 would appply only to this object 
    131131