3 use Benchmark qw(:all);
9 use Class::Method::Modifiers ();
11 printf "Perl %vd on $Config{archname}\n", $^V;
12 my @mods = qw(Moose Mouse Class::Method::Modifiers);
14 if(eval{ require Class::Method::Modifiers::Fast }){
15 push @mods, 'Class::Method::Modifiers::Fast';
18 foreach my $class(@mods){
19 print "$class ", $class->VERSION, "\n";
38 use parent -norequire => qw(Base);
39 use Class::Method::Modifiers;
41 before f => sub{ $i++ };
42 around g => \&main::around;
43 after h => sub{ $i++ };
47 use parent -norequire => qw(Base);
50 before f => sub{ $i++ };
51 around g => \&main::around;
52 after h => sub{ $i++ };
56 use parent -norequire => qw(Base);
59 before f => sub{ $i++ };
60 around g => \&main::around;
61 after h => sub{ $i++ };
64 print "Calling methods with before modifiers:\n";
69 $i == ($old+1) or die $i;
74 $i == ($old+1) or die $i;
79 $i == ($old+1) or die $i;
83 print "\n", "Calling methods with around modifiers:\n";
88 $i == ($old+1) or die $i;
93 $i == ($old+1) or die $i;
98 $i == ($old+1) or die $i;
102 print "\n", "Calling methods with after modifiers:\n";
107 $i == ($old+1) or die $i;
112 $i == ($old+1) or die $i;
117 $i == ($old+1) or die $i;