Changeset 625

Show
Ignore:
Timestamp:
04/30/02 14:06:38
Author:
miyagawa
Message:

0.05

Files:

Legend:

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

    r415 r625  
    11Revision history for Perl extension Class::Trigger. 
     2 
     30.05  Tue Apr 30 14:06:06 JST 2002 
     4        - Example tweak 
     5        - remove untie() lines to shut up bleadperl 
    26 
    370.04  Fri Dec 28 12:43:32 JST 2001 
  • Class-Trigger/trunk/lib/Class/Trigger.pm

    r414 r625  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = '0.04'
     5$VERSION = 0.05
    66 
    77use Class::Data::Inheritable; 
     
    2525    # export mixin methods 
    2626    no strict 'refs'; 
    27     *{"$pkg\::add_trigger"}  = \&add_trigger
    28     *{"$pkg\::call_trigger"} = \&call_trigger
     27    my @methods = qw(add_trigger call_trigger)
     28    *{"$pkg\::$_"} = \&{$_} for @methods
    2929} 
    3030 
     
    105105      my $self = shift; 
    106106      $self->call_trigger('before_foo'); 
    107       $self->do_foo; 
     107      # some code ... 
     108      $self->call_trigger('middle_of_foo'); 
     109      # some code ... 
    108110      $self->call_trigger('after_foo'); 
    109111  } 
  • Class-Trigger/trunk/t/01_trigger.t

    r413 r625  
    1515 
    1616{ 
    17     tie *STDOUT, 'IO::Scalar', \my $out; 
     17    my $out; 
     18    tie *STDOUT, 'IO::Scalar', \$out; 
    1819    $foo->foo; 
    19     untie *STDOUT; 
    2020    is $out, "before_foo\nfoo\nafter_foo\n"; 
    2121} 
     
    2727    tie *STDOUT, 'IO::Scalar', \my $out; 
    2828    $foo->foo; 
    29     untie *STDOUT; 
    3029    is $out, "before_foo\nfoo\nafter_foo\nafter_foo2\n"; 
    3130} 
     
    3736    tie *STDOUT, 'IO::Scalar', \my $out; 
    3837    $foo->foo; 
    39     untie *STDOUT; 
    4038    is $out, "before_foo\nfoo\nafter_foo\nafter_foo2\nFoo", 'class name'; 
    4139} 
  • Class-Trigger/trunk/t/03_inherit.t

    r408 r625  
    2020    tie *STDOUT, 'IO::Scalar', \my $out; 
    2121    $foo->foo; 
    22     untie *STDOUT; 
    2322    is $out, "before_foo\nbefore_foo2\nfoo\nafter_foo\n"; 
    2423} 
     
    2827    tie *STDOUT, 'IO::Scalar', \my $out; 
    2928    $foo_parent->foo; 
    30     untie *STDOUT; 
    3129    is $out, "before_foo\nfoo\n", 'Foo not affected'; 
    3230} 
  • Class-Trigger/trunk/t/04_object.t

    r408 r625  
    1515    $foo->add_trigger(after_foo => sub { print "after_foo\n" }); 
    1616    $foo->foo; 
    17     untie *STDOUT; 
    1817    is $out, "before_foo\nfoo\nafter_foo\n"; 
    1918} 
     
    3332    $foo->add_trigger(after_foo => sub { print "after_foo2\n" }); 
    3433    $foo->foo; 
    35     untie *STDOUT; 
    3634    is $out, "before_foo\nfoo\nafter_foo1\nafter_foo2\n"; 
    3735} 
     
    4139    tie *STDOUT, 'IO::Scalar', \my $out; 
    4240    $foo->foo; 
    43     untie *STDOUT; 
    4441    is $out, "before_foo\nfoo\n"; 
    4542}