use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.60';
+our $VERSION = '0.78';
+$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
use base 'Class::MOP::Method';
package_name => $params{package_name} || $code->package_name,
name => $params{name} || $code->name,
);
- $method->{'%!modifier_table'} = $modifier_table;
+ $method->{'modifier_table'} = $modifier_table;
$method;
}
sub get_original_method {
my $code = shift;
- $code->{'%!modifier_table'}->{orig};
+ $code->{'modifier_table'}->{orig};
}
sub add_before_modifier {
my $code = shift;
my $modifier = shift;
- unshift @{$code->{'%!modifier_table'}->{before}} => $modifier;
- $_build_wrapped_method->($code->{'%!modifier_table'});
+ unshift @{$code->{'modifier_table'}->{before}} => $modifier;
+ $_build_wrapped_method->($code->{'modifier_table'});
+}
+
+sub before_modifiers {
+ my $code = shift;
+ return @{$code->{'modifier_table'}->{before}};
}
sub add_after_modifier {
my $code = shift;
my $modifier = shift;
- push @{$code->{'%!modifier_table'}->{after}} => $modifier;
- $_build_wrapped_method->($code->{'%!modifier_table'});
+ push @{$code->{'modifier_table'}->{after}} => $modifier;
+ $_build_wrapped_method->($code->{'modifier_table'});
+}
+
+sub after_modifiers {
+ my $code = shift;
+ return @{$code->{'modifier_table'}->{after}};
}
{
sub add_around_modifier {
my $code = shift;
my $modifier = shift;
- unshift @{$code->{'%!modifier_table'}->{around}->{methods}} => $modifier;
- $code->{'%!modifier_table'}->{around}->{cache} = $compile_around_method->(
- @{$code->{'%!modifier_table'}->{around}->{methods}},
- $code->{'%!modifier_table'}->{orig}->body
+ unshift @{$code->{'modifier_table'}->{around}->{methods}} => $modifier;
+ $code->{'modifier_table'}->{around}->{cache} = $compile_around_method->(
+ @{$code->{'modifier_table'}->{around}->{methods}},
+ $code->{'modifier_table'}->{orig}->body
);
- $_build_wrapped_method->($code->{'%!modifier_table'});
+ $_build_wrapped_method->($code->{'modifier_table'});
}
}
+sub around_modifiers {
+ my $code = shift;
+ return @{$code->{'modifier_table'}->{around}->{methods}};
+}
+
1;
__END__
=back
+These three methods each returna list of method modifiers I<in the
+order in which they are run>.
+
+=over 4
+
+=item B<before_modifiers>
+
+=item B<after_modifiers>
+
+=item B<around_modifiers>
+
+=back
+
=head1 AUTHORS
Stevan Little E<lt>stevan@iinteractive.comE<gt>