X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod.pm;h=55b22fb236934a7cabaa88dc6a81178c64ec3c74;hb=81c8a65bf02bb1b0e240d8f5b626b0ceabf9a37c;hp=247b33327ab35e21bbb03f4b3e73db758d261747;hpb=fdbdb5e6eb0e4f6c54629f0bde376aba5e69df14;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method.pm b/lib/Class/MOP/Method.pm index 247b333..55b22fb 100644 --- a/lib/Class/MOP/Method.pm +++ b/lib/Class/MOP/Method.pm @@ -8,7 +8,7 @@ use Carp 'confess'; use Scalar::Util 'reftype', 'blessed'; use B 'svref_2object'; -our $VERSION = '0.04'; +our $VERSION = '0.05'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Object'; @@ -16,7 +16,7 @@ use base 'Class::MOP::Object'; # NOTE: # if poked in the right way, # they should act like CODE refs. -use overload '&{}' => sub { $_[0]->{body} }, fallback => 1; +use overload '&{}' => sub { $_[0]->body }, fallback => 1; # introspection @@ -33,13 +33,13 @@ sub wrap { ('CODE' eq (reftype($code) || '')) || confess "You must supply a CODE reference to bless, not (" . ($code || 'undef') . ")"; bless { - body => $code + '&!body' => $code } => blessed($class) || $class; } ## accessors -sub body { (shift)->{body} } +sub body { (shift)->{'&!body'} } # TODO - add associated_class @@ -51,7 +51,7 @@ sub body { (shift)->{body} } # This gets the package stash name # associated with the actual CODE-ref sub package_name { - my $code = (shift)->{body}; + my $code = (shift)->body; svref_2object($code)->GV->STASH->NAME; } @@ -61,7 +61,7 @@ sub package_name { # with. This gets the name associated # with the actual CODE-ref sub name { - my $code = (shift)->{body}; + my $code = (shift)->body; svref_2object($code)->GV->NAME; }