line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Commando::Program; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
28283
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
75
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
52
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
204
|
|
7
|
2
|
|
|
2
|
|
2646
|
use Getopt::Long qw( GetOptionsFromArray ); |
|
2
|
|
|
|
|
43447
|
|
|
2
|
|
|
|
|
13
|
|
8
|
2
|
|
|
2
|
|
4530
|
use Moo; |
|
2
|
|
|
|
|
42708
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'App::Commando::Command'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has 'config' => ( is => 'ro' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
around BUILDARGS => sub { |
15
|
|
|
|
|
|
|
my ($orig, $self, $name) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
return { |
18
|
|
|
|
|
|
|
config => {}, |
19
|
|
|
|
|
|
|
%{$self->$orig($name)} |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
around go => sub { |
24
|
|
|
|
|
|
|
my ($orig, $self, $argv) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
if (!defined $argv) { |
27
|
|
|
|
|
|
|
$argv = \@ARGV; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $cmd = $self->$orig($argv, $self->config); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Run through all options again in case there are any unknown ones |
33
|
|
|
|
|
|
|
Getopt::Long::Configure('no_pass_through'); |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
# Treat Getopt::Long warnings as fatal errors |
36
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { |
37
|
|
|
|
|
|
|
croak @_; |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
GetOptionsFromArray($argv, |
40
|
|
|
|
|
|
|
{ map { $_->for_get_options => undef } @{$self->options} }); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$cmd->execute($argv, $self->config); |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |