X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FRole%2FTiny.pm;h=f908bc2f4c0006782a35fe5afaf7d51e684a878d;hb=8159d057e475ba17e6aab6c083718560dd6626f3;hp=de6a09ecdcc5c7ee45b720e467608e1a2c724250;hpb=b6d9324bf5cf073c46caf27252eeea6a3841aecf;p=gitmo%2FRole-Tiny.git diff --git a/lib/Role/Tiny.pm b/lib/Role/Tiny.pm index de6a09e..f908bc2 100644 --- a/lib/Role/Tiny.pm +++ b/lib/Role/Tiny.pm @@ -64,9 +64,9 @@ sub import { }; # grab all *non-constant* (stash slot is not a scalarref) subs present # in the symbol table and store their refaddrs (no need to forcibly - # inflate constant subs into real subs) - also add '' to here (this - # is used later) with a map to the coderefs in case of copying or re-use - my @not_methods = ('', map { *$_{CODE}||() } grep !ref($_), values %$stash); + # inflate constant subs into real subs) with a map to the coderefs in + # case of copying or re-use + my @not_methods = (map { *$_{CODE}||() } grep !ref($_), values %$stash); @{$INFO{$target}{not_methods}={}}{@not_methods} = @not_methods; # a role does itself $APPLIED_TO{$target} = { $target => undef }; @@ -266,8 +266,7 @@ sub _concrete_methods_of { # grab all code entries that aren't in the not_methods list map { my $code = *{$stash->{$_}}{CODE}; - # rely on the '' key we added in import for "no code here" - exists $not_methods->{$code||''} ? () : ($_ => $code) + ( ! $code or exists $not_methods->{$code} ) ? () : ($_ => $code) } grep !ref($stash->{$_}), keys %$stash }; } @@ -364,6 +363,8 @@ sub does_role { 1; +=encoding utf-8 + =head1 NAME Role::Tiny - Roles. Like a nouvelle cuisine portion size slice of Moose. @@ -511,7 +512,7 @@ will work for classes but to test a role, one must use ::does_role directly. Additionally, Role::Tiny will override the standard Perl C method for your class. However, if C class in your class' inheritance -heirarchy provides C, then Role::Tiny will not override it. +hierarchy provides C, then Role::Tiny will not override it. =head1 METHODS