pass parsed arg object to Invocation when using mx-run
Jonathan Rockway [Thu, 25 Jun 2009 21:41:55 +0000 (14:41 -0700)]
bin/mx-run
lib/MooseX/Runnable/Invocation/MxRun.pm [new file with mode: 0644]
lib/MooseX/Runnable/Invocation/Role/WithParsedArgs.pm [new file with mode: 0644]

index 6e9ddf3..8483eb5 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 use MooseX::Runnable::Util::ArgParser;
-use MooseX::Runnable::Run; # incidentally, we don't actually use this...
+use MooseX::Runnable::Invocation::MxRun;
 
 exit run();
 
@@ -25,9 +25,10 @@ sub run {
     my $app = $args->class_name;
     local $0 = "mx-run ... $app";
 
-    return MooseX::Runnable::Invocation->new(
-        class   => $app,
-        plugins => $args->plugins,
+    return MooseX::Runnable::Invocation::MxRun->new(
+        class       => $app,
+        plugins     => $args->plugins,
+        parsed_args => $args,
     )->run($args->app_args);
 }
 
diff --git a/lib/MooseX/Runnable/Invocation/MxRun.pm b/lib/MooseX/Runnable/Invocation/MxRun.pm
new file mode 100644 (file)
index 0000000..5bae9f2
--- /dev/null
@@ -0,0 +1,7 @@
+package MooseX::Runnable::Invocation::MxRun;
+use Moose;
+
+extends 'MooseX::Runnable::Invocation';
+with 'MooseX::Runnable::Invocation::Role::WithParsedArgs';
+
+1;
diff --git a/lib/MooseX/Runnable/Invocation/Role/WithParsedArgs.pm b/lib/MooseX/Runnable/Invocation/Role/WithParsedArgs.pm
new file mode 100644 (file)
index 0000000..420839f
--- /dev/null
@@ -0,0 +1,11 @@
+package MooseX::Runnable::Invocation::Role::WithParsedArgs;
+use Moose::Role;
+use MooseX::Runnable::Util::ArgParser;
+
+has 'parsed_args' => (
+    is       => 'ro',
+    isa      => 'MooseX::Runnable::Util::ArgParser',
+    required => 1,
+);
+
+1;