Commit | Line | Data |
780724cb |
1 | package MooseX::Runnable::Invocation::Scheme::MooseX::Getopt; |
2 | use Moose::Role; |
3 | |
4 | around validate_class => sub { |
5 | return; # always valid |
6 | }; |
7 | |
8 | around create_instance => sub { |
9 | my ($next, $self, $class, @args) = @_; |
10 | |
11 | local @ARGV = @args; # ugly! |
12 | my $instance = $class->name->new_with_options(); |
13 | |
14 | my $more_args = $instance->extra_argv; |
15 | |
16 | return ($instance, @$more_args); |
17 | }; |
18 | |
19 | 1; |
00d7989a |
20 | |
21 | __END__ |
22 | |
23 | =head1 NAME |
24 | |
25 | MooseX::Runnable::Invocation::Scheme::MooseX::Getopt - run MX::Getopt classes |
26 | |
27 | =head1 DESCRIPTION |
28 | |
29 | This role will be used by C<MooseX::Runnable::Invocation> to create an |
30 | instance of the class to be run with C<MooseX::Getopt>. Any args not |
31 | consumed by MX::Getopt will be passed to the class's run method. |
32 | |
33 | (See the test C<t/basic-mx-getopt.t> for an example.) |
34 | |