line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
364770
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
116
|
|
2
|
5
|
|
|
5
|
|
20
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
225
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::App; |
5
|
|
|
|
|
|
|
$Footprintless::App::VERSION = '1.28'; |
6
|
|
|
|
|
|
|
# ABSTRACT: The base application class for fpl |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::App |
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
1916
|
use App::Cmd::Setup -app; |
|
5
|
|
|
|
|
120722
|
|
|
5
|
|
|
|
|
32
|
|
10
|
5
|
|
|
5
|
|
3258
|
use Footprintless; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
100
|
|
11
|
5
|
|
|
5
|
|
23
|
use Footprintless::Util qw(dynamic_module_new); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
208
|
|
12
|
5
|
|
|
5
|
|
23
|
use Log::Any; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
45
|
|
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
|
|
64
|
my ( $self, %options ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
14
|
|
|
|
|
49
|
my $log_configurator_module = |
23
|
|
|
|
|
|
|
$self->footprintless()->entities()->get_entity('footprintless.log_configurator'); |
24
|
14
|
50
|
|
|
|
261
|
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
|
283
|
$pretend_self = {}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub footprintless { |
41
|
33
|
|
|
33
|
1
|
86
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
33
|
100
|
|
|
|
87
|
if ( !defined( $pretend_self->{footprintless} ) ) { |
44
|
7
|
|
|
|
|
35
|
$pretend_self->{footprintless} = Footprintless->new(); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
33
|
|
|
|
|
156
|
return $pretend_self->{footprintless}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_command { |
51
|
14
|
|
|
14
|
1
|
44484
|
my ( $self, @args ) = @_; |
52
|
14
|
|
|
|
|
63
|
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
|
|
|
|
|
13011
|
); |
60
|
|
|
|
|
|
|
|
61
|
14
|
|
|
|
|
64
|
return ( $command, $opt, @rest ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub global_opt_spec { |
65
|
14
|
|
|
14
|
1
|
182
|
my ($self) = @_; |
66
|
14
|
|
|
|
|
47
|
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
|
640
|
my ($self) = @_; |
72
|
|
|
|
|
|
|
|
73
|
5
|
|
|
|
|
12
|
my @paths = (); |
74
|
5
|
|
|
|
|
16
|
foreach my $plugin ( $self->footprintless()->plugins() ) { |
75
|
0
|
|
|
|
|
0
|
push( @paths, $plugin->command_packages() ); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
5
|
|
|
|
|
14
|
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
|
12107
|
my ($self) = @_; |
97
|
|
|
|
|
|
|
|
98
|
5
|
|
|
|
|
18
|
my $search_path = |
99
|
|
|
|
|
|
|
[ 'Footprintless::App::Command', $self->footprintless_plugin_search_paths() ]; |
100
|
|
|
|
|
|
|
|
101
|
5
|
|
|
|
|
53
|
return $search_path; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |