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';
# 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
('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
# 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;
}
# 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;
}