| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
5
|
|
|
5
|
|
347136
|
use strict; |
|
|
5
|
|
|
|
|
14
|
|
|
|
5
|
|
|
|
|
146
|
|
|
2
|
5
|
|
|
5
|
|
29
|
use warnings; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
278
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::App; |
|
5
|
|
|
|
|
|
|
$Footprintless::App::VERSION = '1.26'; |
|
6
|
|
|
|
|
|
|
# ABSTRACT: The base application class for fpl |
|
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::App |
|
8
|
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
1376
|
use App::Cmd::Setup -app; |
|
|
5
|
|
|
|
|
112174
|
|
|
|
5
|
|
|
|
|
34
|
|
|
10
|
5
|
|
|
5
|
|
3137
|
use Footprintless; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
107
|
|
|
11
|
5
|
|
|
5
|
|
23
|
use Footprintless::Util qw(dynamic_module_new); |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
222
|
|
|
12
|
5
|
|
|
5
|
|
25
|
use Log::Any; |
|
|
5
|
|
|
|
|
17
|
|
|
|
5
|
|
|
|
|
40
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# todo: remove after https://github.com/rjbs/App-Cmd/pull/60 |
|
17
|
|
|
|
|
|
|
my $pretend_self = {}; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _configure_logging { |
|
20
|
14
|
|
|
14
|
|
68
|
my ( $self, %options ) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
14
|
|
|
|
|
48
|
my $log_configurator_module = |
|
23
|
|
|
|
|
|
|
$self->footprintless()->entities()->get_entity('footprintless.log_configurator'); |
|
24
|
14
|
50
|
|
|
|
293
|
if ($log_configurator_module) { |
|
|
|
50
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
dynamic_module_new($log_configurator_module)->configure(%options); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
elsif ( $options{log_level} ) { |
|
28
|
0
|
|
|
|
|
0
|
require Log::Any::Adapter; |
|
29
|
|
|
|
|
|
|
Log::Any::Adapter->set( 'Stderr', |
|
30
|
0
|
|
|
|
|
0
|
log_level => Log::Any::Adapter::Util::numeric_level( $options{log_level} ) ); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub clear_pretend_self { |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#used by unit tests to clear out predend self hack between tests |
|
37
|
4
|
|
|
4
|
0
|
334
|
$pretend_self = {}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub footprintless { |
|
41
|
33
|
|
|
33
|
1
|
100
|
my ($self) = @_; |
|
42
|
|
|
|
|
|
|
|
|
43
|
33
|
100
|
|
|
|
103
|
if ( !defined( $pretend_self->{footprintless} ) ) { |
|
44
|
7
|
|
|
|
|
38
|
$pretend_self->{footprintless} = Footprintless->new(); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
33
|
|
|
|
|
176
|
return $pretend_self->{footprintless}; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_command { |
|
51
|
14
|
|
|
14
|
1
|
40746
|
my ( $self, @args ) = @_; |
|
52
|
14
|
|
|
|
|
84
|
my ( $command, $opt, @rest ) = $self->App::Cmd::get_command(@args); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$self->_configure_logging( |
|
55
|
|
|
|
|
|
|
command => $command, |
|
56
|
|
|
|
|
|
|
opt => $opt, |
|
57
|
|
|
|
|
|
|
rest => \@rest, |
|
58
|
|
|
|
|
|
|
log_level => delete( $opt->{log} ) |
|
59
|
14
|
|
|
|
|
14098
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
14
|
|
|
|
|
67
|
return ( $command, $opt, @rest ); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub global_opt_spec { |
|
65
|
14
|
|
|
14
|
1
|
209
|
my ($self) = @_; |
|
66
|
14
|
|
|
|
|
67
|
return ( [ "log=s", "sets the log level", ], $self->App::Cmd::global_opt_spec() ); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# todo: remove after https://github.com/rjbs/App-Cmd/pull/60 |
|
70
|
|
|
|
|
|
|
sub footprintless_plugin_search_paths { |
|
71
|
5
|
|
|
5
|
0
|
11
|
my ($self) = @_; |
|
72
|
|
|
|
|
|
|
|
|
73
|
5
|
|
|
|
|
10
|
my @paths = (); |
|
74
|
5
|
|
|
|
|
613
|
foreach my $plugin ( $self->footprintless()->plugins() ) { |
|
75
|
0
|
|
|
|
|
0
|
push( @paths, $plugin->command_packages() ); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
5
|
|
|
|
|
15
|
return @paths; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub REAL_footprintless_plugin_search_paths { |
|
82
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
0
|
unless ( $self->{plugin_search_paths} ) { |
|
85
|
0
|
|
|
|
|
0
|
my @paths = (); |
|
86
|
0
|
|
|
|
|
0
|
foreach my $plugin ( $self->footprintless()->plugins() ) { |
|
87
|
0
|
|
|
|
|
0
|
push( @paths, $plugin->command_packages() ); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
0
|
|
|
|
|
0
|
$self->{plugin_search_paths} = \@paths; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
0
|
return @{ $self->{plugin_search_paths} }; |
|
|
0
|
|
|
|
|
0
|
|
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub plugin_search_path { |
|
96
|
5
|
|
|
5
|
1
|
12187
|
my ($self) = @_; |
|
97
|
|
|
|
|
|
|
|
|
98
|
5
|
|
|
|
|
19
|
my $search_path = |
|
99
|
|
|
|
|
|
|
[ 'Footprintless::App::Command', $self->footprintless_plugin_search_paths() ]; |
|
100
|
|
|
|
|
|
|
|
|
101
|
5
|
|
|
|
|
45
|
return $search_path; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |