line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
439914
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
217
|
|
2
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
282
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::App; |
5
|
|
|
|
|
|
|
$Footprintless::App::VERSION = '1.29'; |
6
|
|
|
|
|
|
|
# ABSTRACT: The base application class for fpl |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::App |
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
2046
|
use App::Cmd::Setup -app; |
|
5
|
|
|
|
|
156141
|
|
|
5
|
|
|
|
|
38
|
|
10
|
5
|
|
|
5
|
|
3483
|
use Footprintless; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
121
|
|
11
|
5
|
|
|
5
|
|
24
|
use Footprintless::Util qw(dynamic_module_new); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
303
|
|
12
|
5
|
|
|
5
|
|
29
|
use Log::Any; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
37
|
|
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
|
|
83
|
my ( $self, %options ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
14
|
|
|
|
|
42
|
my $log_configurator_module = |
23
|
|
|
|
|
|
|
$self->footprintless()->entities()->get_entity('footprintless.log_configurator'); |
24
|
14
|
50
|
|
|
|
254
|
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
|
249
|
$pretend_self = {}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub footprintless { |
41
|
33
|
|
|
33
|
1
|
82
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
33
|
100
|
|
|
|
143
|
if ( !defined( $pretend_self->{footprintless} ) ) { |
44
|
7
|
|
|
|
|
41
|
$pretend_self->{footprintless} = Footprintless->new(); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
33
|
|
|
|
|
955
|
return $pretend_self->{footprintless}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_command { |
51
|
14
|
|
|
14
|
1
|
47653
|
my ( $self, @args ) = @_; |
52
|
14
|
|
|
|
|
65
|
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
|
|
|
|
|
14296
|
); |
60
|
|
|
|
|
|
|
|
61
|
14
|
|
|
|
|
57
|
return ( $command, $opt, @rest ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub global_opt_spec { |
65
|
14
|
|
|
14
|
1
|
186
|
my ($self) = @_; |
66
|
14
|
|
|
|
|
49
|
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
|
12
|
my ($self) = @_; |
72
|
|
|
|
|
|
|
|
73
|
5
|
|
|
|
|
11
|
my @paths = (); |
74
|
5
|
|
|
|
|
17
|
foreach my $plugin ( $self->footprintless()->plugins() ) { |
75
|
0
|
|
|
|
|
0
|
push( @paths, $plugin->command_packages() ); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
5
|
|
|
|
|
13
|
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
|
14209
|
my ($self) = @_; |
97
|
|
|
|
|
|
|
|
98
|
5
|
|
|
|
|
17
|
my $search_path = |
99
|
|
|
|
|
|
|
[ 'Footprintless::App::Command', $self->footprintless_plugin_search_paths() ]; |
100
|
|
|
|
|
|
|
|
101
|
5
|
|
|
|
|
44
|
return $search_path; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |