From: Florian Ragwitz Date: Thu, 4 Dec 2008 02:03:45 +0000 (+0000) Subject: Make the perl version of get_all_package_symbols handle stub functions. X-Git-Tag: 0.71_01~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1cd37c2226c57b60805002ee5a20c0fd50db69a;p=gitmo%2FClass-MOP.git Make the perl version of get_all_package_symbols handle stub functions. This also fixes the pure perl version of get_method_map, as it uses get_all_package_symbols internally. --- diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index a1cf6a6..8a5ec01 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -4,6 +4,7 @@ package Class::MOP::Package; use strict; use warnings; +use B; use Scalar::Util 'blessed'; use Carp 'confess'; @@ -293,7 +294,12 @@ sub get_all_package_symbols { ? ( $_ => \&{$pkg ||= $self->name . "::$_"} ) : ( (*{$namespace->{$_}}{CODE}) # the extra parents prevent breakage on 5.8.2 ? ( $_ => *{$namespace->{$_}}{CODE} ) - : () ) ) + : (do { + my $sym = B::svref_2object(\$namespace->{$_}); + my $svt = ref $sym if $sym; + ($sym && ($svt eq 'B::PV' || $svt eq 'B::PVIV')) + ? ($_ => ($pkg ||= $self->name)->can($_)) + : () }) ) ) } keys %$namespace; } else { return map {