| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ============================================================================ |
|
2
|
|
|
|
|
|
|
package MooseX::App::Role::Base; |
|
3
|
|
|
|
|
|
|
# ============================================================================ |
|
4
|
|
|
|
|
|
|
|
|
5
|
15
|
|
|
15
|
|
13244
|
use 5.010; |
|
|
15
|
|
|
|
|
65
|
|
|
6
|
15
|
|
|
15
|
|
97
|
use utf8; |
|
|
15
|
|
|
|
|
31
|
|
|
|
15
|
|
|
|
|
129
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
456
|
use namespace::autoclean; |
|
|
15
|
|
|
|
|
32
|
|
|
|
15
|
|
|
|
|
2509
|
|
|
9
|
15
|
|
|
15
|
|
1623
|
use Moose::Role; |
|
|
15
|
|
|
|
|
45
|
|
|
|
15
|
|
|
|
|
2327
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub initialize_command_class { |
|
12
|
74
|
|
|
74
|
0
|
259
|
my ($class,$command_class,%args) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
74
|
|
|
|
|
351
|
my $meta = $class->meta; |
|
15
|
|
|
|
|
|
|
|
|
16
|
74
|
50
|
|
|
|
1960
|
Moose->throw_error('initialize_command_class is a class method') |
|
17
|
|
|
|
|
|
|
if blessed($class); |
|
18
|
|
|
|
|
|
|
|
|
19
|
74
|
|
|
|
|
870
|
my ($ok,$error) = Class::Load::try_load_class($command_class); |
|
20
|
74
|
50
|
|
|
|
3125
|
unless ($ok) { |
|
21
|
0
|
|
|
|
|
0
|
Moose->throw_error($error); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
74
|
|
33
|
|
|
422
|
my $command_meta = $command_class->meta || $meta; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Build MooseX::App::ParsedArgv and set hints |
|
27
|
74
|
|
|
|
|
1701
|
my $parsed_argv = MooseX::App::ParsedArgv->instance(); |
|
28
|
74
|
|
|
|
|
422
|
my $hints = $meta->command_parser_hints($command_meta); |
|
29
|
74
|
|
|
|
|
3100
|
$parsed_argv->hints_fixedvalue($hints->{fixedvalue}); |
|
30
|
74
|
|
|
|
|
2616
|
$parsed_argv->hints_novalue($hints->{novalue}); |
|
31
|
74
|
100
|
|
|
|
2802
|
if ($meta->app_permute) { |
|
32
|
34
|
|
|
|
|
1003
|
$parsed_argv->hints_permute($hints->{permute}); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
74
|
|
|
|
|
449
|
my ($proto_result,$proto_errors) = $meta->command_proto($command_meta); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# TODO return some kind of null class object |
|
38
|
|
|
|
|
|
|
return |
|
39
|
74
|
50
|
|
|
|
277
|
unless defined $proto_result; |
|
40
|
|
|
|
|
|
|
|
|
41
|
74
|
|
|
|
|
185
|
my @errors = @{$proto_errors}; |
|
|
74
|
|
|
|
|
234
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Return user-requested help |
|
44
|
74
|
100
|
|
|
|
260
|
if ($proto_result->{help_flag}) { |
|
45
|
6
|
|
|
|
|
48
|
return MooseX::App::Message::Envelope->new( |
|
46
|
|
|
|
|
|
|
$meta->command_usage_command($command_class->meta), |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
68
|
|
|
|
|
422
|
my ($result,$errors) = $meta->command_args($command_meta); |
|
51
|
67
|
|
|
|
|
177
|
push(@errors,@{$errors}); |
|
|
67
|
|
|
|
|
165
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
67
|
|
|
|
|
154
|
my %params; |
|
54
|
67
|
100
|
|
|
|
2601
|
if ($meta->app_prefer_commandline) { |
|
55
|
|
|
|
|
|
|
%params = ( |
|
56
|
|
|
|
|
|
|
%args, # configs passed to new |
|
57
|
7
|
|
|
|
|
15
|
%{ $proto_result }, # config params |
|
58
|
7
|
|
|
|
|
16
|
%{ $result }, # params from CLI |
|
|
7
|
|
|
|
|
37
|
|
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
} else { |
|
61
|
|
|
|
|
|
|
%params = ( |
|
62
|
60
|
|
|
|
|
227
|
%{ $proto_result }, # config params |
|
63
|
60
|
|
|
|
|
136
|
%{ $result }, # params from CLI |
|
|
60
|
|
|
|
|
343
|
|
|
64
|
|
|
|
|
|
|
%args, # configs passed to new |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
67
|
|
|
|
|
515
|
$meta->command_check_attributes($command_meta,\@errors,\%params); |
|
69
|
|
|
|
|
|
|
|
|
70
|
67
|
100
|
|
|
|
238
|
if (scalar @errors) { |
|
71
|
23
|
|
|
|
|
195
|
return MooseX::App::Message::Envelope->new( |
|
72
|
|
|
|
|
|
|
@errors, |
|
73
|
|
|
|
|
|
|
$meta->command_usage_command($command_meta), |
|
74
|
|
|
|
|
|
|
1, # exitcode |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
44
|
|
|
|
|
382
|
my $command_object = $command_class->new( |
|
79
|
|
|
|
|
|
|
%params, |
|
80
|
|
|
|
|
|
|
extra_argv => [ $parsed_argv->extra ], |
|
81
|
|
|
|
|
|
|
); |
|
82
|
|
|
|
|
|
|
|
|
83
|
44
|
50
|
|
|
|
92094
|
if (scalar @errors) { |
|
84
|
0
|
|
|
|
|
0
|
return MooseX::App::Message::Envelope->new( |
|
85
|
|
|
|
|
|
|
@errors, |
|
86
|
|
|
|
|
|
|
$meta->command_usage_command($command_meta), |
|
87
|
|
|
|
|
|
|
1, # exitcode |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
44
|
|
|
|
|
715
|
return $command_object; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |