6 use MooseX::Runnable::Run; # incidentally, we don't actually use this...
11 my ($includes, $plugins, $app, $argv) = parse_argv();
13 unshift @INC, $_ for @$includes;
16 local $0 = "mx-run ... $app";
18 return MooseX::Runnable::Invocation->new(
20 plugins => $plugins || [],
25 # we need to parse "incrementally" so we can identify:
26 # - our args (-Ilib, and --help, -h, and -?)
27 # - plugins to load (+Plugin)
30 # code that's better than this is welcome!
32 my (@include, @plugins, $app);
34 while( my $arg = shift @ARGV ){
35 if ($arg =~ /^-I([^-]+)/){ # XXX: handle -I"quoted string" ?
38 elsif ($arg =~ /^-M([^-]+)/){
43 elsif ($arg =~ /^\+\+?([A-Za-z:_]+)$/){ # second + is for +Foo::Bar
46 elsif ($arg =~ /^--([^-]+)$/){
50 if($arg =~ /^([A-Za-z:_]+)$/){
60 return \@include, \@plugins, $app, \@ARGV;
66 This is mx-run, a utility for running MooseX::Runnable classes.
67 usage: mx-run <mx-run options> Class::Name <options for Class::Name>
70 --help -? -h Print this message
71 -I<path> Add <path> to @INC before loading Class::Name
72 -M<module> use <module> immediately
73 +PluginName Load PluginName (see MooseX::Runnable::Invocation)
75 Note that as soon as +PluginName is seen, all -[IM] options are
76 ignored by mx-run, and are instead processed by PluginName.
78 To get help for Class::Name, run:
80 mx-run Class::Name --help
90 mx-run - script to run MooseX::Runnable classes