+ - Switch Moo::Utils to using Module::Runtime, and add the 5.8 %INC
+ leakage fix into Role::Tiny's _load_module to provide partial parity
- Update incompatibilities with Moose documentation
- Remove Sub::Quote's outstanding queue since it doesn't actually slow
things down to do it this way and makes debugging easier.
my %RUN_DEPS = (
'Class::Method::Modifiers' => 1.07,
'strictures' => 1.001001,
+ 'Module::Runtime' => 0.013,
);
# have to do this since old EUMM dev releases miss the eval $VERSION line
}
use strictures 1;
+use Module::Runtime qw(require_module);
use base qw(Exporter);
use Moo::_mro;
our %MAYBE_LOADED;
-# _load_module is inlined in Role::Tiny - make sure to copy if you update it.
-
sub _load_module {
(my $proto = $_[0]) =~ s/::/\//g;
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])||{}};
- { require "${proto}.pm"; }
+ require_module($_[0]);
return 1;
}
our %APPLIED_TO;
our %COMPOSED;
-# inlined from Moo::_Utils - update that first.
+# Module state workaround totally stolen from Zefram's Module::Runtime.
+
+BEGIN {
+ *_WORK_AROUND_BROKEN_MODULE_STATE = "$]" < 5.009 ? sub(){1} : sub(){0};
+}
+
+sub Role::Tiny::__GUARD__::DESTROY {
+ delete $INC{$_[0]->[0]} if @{$_[0]};
+}
sub _load_module {
(my $proto = $_[0]) =~ s/::/\//g;
- return 1 if $INC{"${proto}.pm"};
+ $proto .= '.pm';
+ return 1 if $INC{$proto};
# 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])||{}};
- require "${proto}.pm";
+ my $guard = _WORK_AROUND_BROKEN_MODULE_STATE
+ && bless([ $proto ], 'Role::Tiny::__GUARD__');
+ require $proto;
+ pop @$guard if _WORK_AROUND_BROKEN_MODULE_STATE;
return 1;
}