From: Jonathan Rockway Date: Thu, 25 Jun 2009 21:41:55 +0000 (-0700) Subject: pass parsed arg object to Invocation when using mx-run X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=040d22bb436c86e182fc04b62862e29f74c86c5c;p=gitmo%2FMooseX-Runnable.git pass parsed arg object to Invocation when using mx-run --- diff --git a/bin/mx-run b/bin/mx-run index 6e9ddf3..8483eb5 100644 --- a/bin/mx-run +++ b/bin/mx-run @@ -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 index 0000000..5bae9f2 --- /dev/null +++ b/lib/MooseX/Runnable/Invocation/MxRun.pm @@ -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 index 0000000..420839f --- /dev/null +++ b/lib/MooseX/Runnable/Invocation/Role/WithParsedArgs.pm @@ -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;