X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod%2FWrapped.pm;h=07a2ee5166383fd7de4342e6af0e3a8b4957027b;hb=92e250b0af746085306392cd25e053f3000ca3d3;hp=6e664be6d228c94f2e322f7057d44258be8c81e8;hpb=4c1053331a179a6d1dd8e71d49ef05852a81387e;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method/Wrapped.pm b/lib/Class/MOP/Method/Wrapped.pm index 6e664be..07a2ee5 100644 --- a/lib/Class/MOP/Method/Wrapped.pm +++ b/lib/Class/MOP/Method/Wrapped.pm @@ -5,9 +5,10 @@ use strict; use warnings; use Carp 'confess'; -use Scalar::Util 'reftype', 'blessed'; +use Scalar::Util 'blessed'; -our $VERSION = '0.02'; +our $VERSION = '0.69_01'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Method'; @@ -91,27 +92,37 @@ sub wrap { 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}}; } { @@ -132,15 +143,20 @@ sub add_after_modifier { 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__ @@ -190,6 +206,19 @@ see the section in L. =back +These three methods each returna list of method modifiers I. + +=over 4 + +=item B + +=item B + +=item B + +=back + =head1 AUTHORS Stevan Little Estevan@iinteractive.comE