File Coverage

blib/lib/MooseX/Runnable/Invocation/Scheme/MooseX/Getopt.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package MooseX::Runnable::Invocation::Scheme::MooseX::Getopt;
2              
3             our $VERSION = '0.10';
4              
5 1     1   1517 use Moose::Role;
  1         1  
  1         5  
6 1     1   3039 use namespace::autoclean;
  1         1  
  1         5  
7              
8             around validate_class => sub {
9             return; # always valid
10             };
11              
12             around create_instance => sub {
13             my ($next, $self, $class, @args) = @_;
14              
15             local @ARGV = @args; # ugly!
16             my $instance = $class->name->new_with_options();
17              
18             my $more_args = $instance->extra_argv;
19              
20             return ($instance, @$more_args);
21             };
22              
23             # XXX: arounds that don't actually call $orig fuck up plugins. i
24             # think that's OK, mostly, but it's something to keep in mind...
25              
26             1;
27              
28             __END__
29              
30             =head1 NAME
31              
32             MooseX::Runnable::Invocation::Scheme::MooseX::Getopt - run MX::Getopt classes
33              
34             =head1 DESCRIPTION
35              
36             This role will be used by C<MooseX::Runnable::Invocation> to create an
37             instance of the class to be run with C<MooseX::Getopt>. Any args not
38             consumed by MX::Getopt will be passed to the class's run method.
39              
40             (See the test C<t/basic-mx-getopt.t> for an example.)
41              
42             =head1 SEE ALSO
43              
44             L<MooseX::Runnable>
45              
46             L<MooseX::Getopt>