X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FRunnable%2FInvocation.pm;h=d340743f9604294a5c92150c9b3e1fe9c6401f2e;hb=7da369caa65930c3f7edf9c6878468ab1454d33a;hp=b21617c24db655efa4e71bff71493e9496e89265;hpb=c1cc9df99770624371779e1cd537d130410cd568;p=gitmo%2FMooseX-Runnable.git diff --git a/lib/MooseX/Runnable/Invocation.pm b/lib/MooseX/Runnable/Invocation.pm index b21617c..d340743 100644 --- a/lib/MooseX/Runnable/Invocation.pm +++ b/lib/MooseX/Runnable/Invocation.pm @@ -4,10 +4,9 @@ use MooseX::Types -declare => ['RunnableClass']; use MooseX::Types::Moose qw(Str HashRef ArrayRef); use List::MoreUtils qw(uniq); use Params::Util qw(_CLASS); +use Module::Runtime 'use_module'; use namespace::autoclean; -require Class::MOP; - # we can't load the class until plugins are loaded, # so we have to handle this outside of coerce @@ -45,7 +44,7 @@ sub BUILD { $plugin = "$plugin_ns$plugin" unless $plugin =~ /^[+]/; $plugin =~ s/^[+]//g; - Class::MOP::load_class( $plugin ); + use_module( $plugin ); my $does_cmdline = $plugin->meta-> does_role('MooseX::Runnable::Invocation::Plugin::Role::CmdlineArgs'); @@ -81,7 +80,7 @@ sub load_class { my $self = shift; my $class = $self->class; - Class::MOP::load_class( $class ); + use_module( $class ); confess 'We can only work with Moose classes with "meta" methods' if !$class->can('meta'); @@ -123,7 +122,7 @@ sub _convert_role_to_scheme { $name = "MooseX::Runnable::Invocation::Scheme::$name"; return eval { - Class::MOP::load_class($name); + use_module($name); warn "$name was loaded OK, but it's not a role!" and return unless $name->meta->isa('Moose::Meta::Role'); return $name->meta;