fix silly bug in _load_module
[gitmo/Moo.git] / lib / Moo / _Utils.pm
index 554789b..a228805 100644 (file)
@@ -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;
 }