X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FPurePerl.pm;h=c0a8e0a7baee94841dd849e93f90e0a495dbe5cf;hb=3821b191b0493223e0f67b05ad351e3753fcfc66;hp=383c0c8e69734d990062c05a6a980ee87cba2b49;hpb=f18345f1ff14d11b71695cde4b67638ae942af8c;p=gitmo%2FMouse.git diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index 383c0c8..c0a8e0a 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -18,15 +18,20 @@ sub is_class_loaded { return 0 if ref($class) || !defined($class) || !length($class); # walk the symbol table tree to avoid autovififying - # \*{${main::}{"Foo::"}} == \*main::Foo:: + # \*{${main::}{"Foo::"}{"Bar::"}} == \*main::Foo::Bar:: my $pack = \%::; foreach my $part (split('::', $class)) { - my $entry = \$pack->{$part . '::'}; + $part .= '::'; + return 0 if !exists $pack->{$part}; + + my $entry = \$pack->{$part}; return 0 if ref($entry) ne 'GLOB'; - $pack = *{$entry}{HASH} or return 0; + $pack = *{$entry}{HASH}; } + return 0 if !%{$pack}; + # check for $VERSION or @ISA return 1 if exists $pack->{VERSION} && defined *{$pack->{VERSION}}{SCALAR} && defined ${ $pack->{VERSION} };