printf "Perl %vd on $Config{archname}\n", $^V;
my @mods = qw(Moose Mouse Class::Method::Modifiers);
-if(eval{ require Class::Method::Modifiers::Fast }){
- push @mods, 'Class::Method::Modifiers::Fast';
-}
-
foreach my $class(@mods){
print "$class ", $class->VERSION, "\n";
}
my $modifier_table = $self->{modifiers}{$name};
if(!$modifier_table){
- my(@before, @after, $cache);
-
- $cache = $original;
-
- my $around_only = ($type eq 'around');
-
+ my(@before, @after, @around);
+ my $cache = $original;
my $modified = sub {
- if($around_only) {
+ if(@before) {
+ for my $c (@before) { $c->(@_) }
+ }
+ unless(@after) {
return $cache->(@_);
}
- for my $c (@before) { $c->(@_) }
-
if(wantarray){ # list context
my @rval = $cache->(@_);
before => \@before,
after => \@after,
- around => \my @around,
- around_only => \$around_only,
+ around => \@around,
cache => \$cache, # cache for around modifiers
};
}
if($type eq 'before'){
- ${$modifier_table->{around_only}} = 0;
unshift @{$modifier_table->{before}}, $code;
}
elsif($type eq 'after'){
- ${$modifier_table->{around_only}} = 0;
push @{$modifier_table->{after}}, $code;
}
else{ # around