From: Florian Ragwitz Date: Thu, 4 Dec 2008 03:12:12 +0000 (+0000) Subject: Don't stringify the globs of stub functions. X-Git-Tag: 0.71_01~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=361c0e55b5979fcb3613efb0651171b454fe3c16;p=gitmo%2FClass-MOP.git Don't stringify the globs of stub functions. --- diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 8a5ec01..8d8782c 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -292,12 +292,13 @@ sub get_all_package_symbols { return map { (ref($namespace->{$_}) ? ( $_ => \&{$pkg ||= $self->name . "::$_"} ) - : ( (*{$namespace->{$_}}{CODE}) # the extra parents prevent breakage on 5.8.2 + : ( ref \$namespace->{$_} eq 'GLOB' # don't use {CODE} unless it's really a glob to prevent stringification of stubs + && (*{$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')) + ($sym && ($svt eq 'B::PV' || $svt eq 'B::IV')) ? ($_ => ($pkg ||= $self->name)->can($_)) : () }) ) ) } keys %$namespace;