From: Matt S Trout Date: Fri, 20 Apr 2012 07:20:49 +0000 (+0000) Subject: fix silly bug in _load_module X-Git-Tag: v0.091000~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2a577e534860775e35e35410075a38acc91f8fb0;p=gitmo%2FMoo.git fix silly bug in _load_module --- diff --git a/Changes b/Changes index d80839b..a4ae541 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ + - fix bug in _load_module where global vars could cause mis-detection + of the module already being loaded + 0.009_017 - 2012-04-16 - mangle constructor meta-method on inflation so make_immutable works - fix possible infinite loop caused by subconstructor code diff --git a/lib/Moo/_Utils.pm b/lib/Moo/_Utils.pm index 554789b..a228805 100644 --- a/lib/Moo/_Utils.pm +++ b/lib/Moo/_Utils.pm @@ -40,7 +40,8 @@ sub _load_module { return 1 if $INC{"${proto}.pm"}; # can't just ->can('can') because a sub-package Foo::Bar::Baz # creates a 'Baz::' key in Foo::Bar's symbol table - return 1 if grep !/::$/, keys %{_getstash($_[0])||{}}; + my $stash = _getstash($_[0])||{}; + return 1 if grep +(!ref($_) and *$_{CODE}), values %$stash; require_module($_[0]); return 1; }