line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
1361693
|
use strict; |
|
8
|
|
|
|
|
57
|
|
|
8
|
|
|
|
|
206
|
|
2
|
8
|
|
|
8
|
|
33
|
use warnings; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
158
|
|
3
|
8
|
|
|
8
|
|
166
|
use 5.014; |
|
8
|
|
|
|
|
22
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moose::Role; |
7
|
8
|
|
|
8
|
|
3156
|
use namespace::autoclean; |
|
8
|
|
|
|
|
2851295
|
|
|
8
|
|
|
|
|
36
|
|
8
|
8
|
|
|
8
|
|
44129
|
use Getopt::Long qw( GetOptionsFromArray ); |
|
8
|
|
|
|
|
56966
|
|
|
8
|
|
|
|
|
27
|
|
9
|
8
|
|
|
8
|
|
5618
|
use Pod::Usage qw( pod2usage ); |
|
8
|
|
|
|
|
73162
|
|
|
8
|
|
|
|
|
35
|
|
10
|
8
|
|
|
8
|
|
5301
|
|
|
8
|
|
|
|
|
267694
|
|
|
8
|
|
|
|
|
3628
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: Command line tool for alienfile |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has args => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
17
|
|
|
|
|
|
|
default => sub { [] } |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
my($class, @args) = @_; |
22
|
|
|
|
|
|
|
|
23
|
33
|
|
|
33
|
0
|
22307
|
my($subcommand) = $class =~ /App::af::(.*)/; |
24
|
|
|
|
|
|
|
my %args = ( args => \@args ); |
25
|
33
|
|
|
|
|
175
|
|
26
|
33
|
|
|
|
|
111
|
my @options = ( |
27
|
|
|
|
|
|
|
'help' => sub { |
28
|
|
|
|
|
|
|
pod2usage({ |
29
|
|
|
|
|
|
|
-verbose => 99, |
30
|
0
|
0
|
|
0
|
|
0
|
-sections => $subcommand eq 'default' ? "SYNOPSIS|DESCRIPTION" : "SUBCOMMANDS/$subcommand", |
31
|
|
|
|
|
|
|
-exitval => 0, |
32
|
|
|
|
|
|
|
}) }, |
33
|
|
|
|
|
|
|
'version' => sub { |
34
|
|
|
|
|
|
|
say "App::af version ", ($App::af::VERSION // 'dev'); |
35
|
|
|
|
|
|
|
exit; |
36
|
0
|
|
0
|
0
|
|
0
|
}, |
37
|
0
|
|
|
|
|
0
|
); |
38
|
|
|
|
|
|
|
|
39
|
33
|
|
|
|
|
264
|
foreach my $attr ($class->meta->get_all_attributes) |
40
|
|
|
|
|
|
|
{ |
41
|
33
|
|
|
|
|
176
|
next unless $attr->does("App::af::opt"); |
42
|
|
|
|
|
|
|
my $name = $attr->name; |
43
|
171
|
100
|
|
|
|
4676
|
$name =~ s/_/-/g; |
44
|
138
|
|
|
|
|
28749
|
$name .= '|' . $attr->short if $attr->short; |
45
|
138
|
|
|
|
|
266
|
$name .= "=" . $attr->opt_type if $attr->opt_type; |
46
|
138
|
100
|
|
|
|
3092
|
if($attr->is_array) |
47
|
138
|
100
|
|
|
|
2914
|
{ |
48
|
138
|
100
|
|
|
|
2884
|
my @array; |
49
|
|
|
|
|
|
|
$args{$attr->name} = \@array; |
50
|
6
|
|
|
|
|
10
|
push @options, $name => \@array; |
51
|
6
|
|
|
|
|
19
|
} |
52
|
6
|
|
|
|
|
16
|
else |
53
|
|
|
|
|
|
|
{ |
54
|
|
|
|
|
|
|
push @options, $name => \$args{$attr->name}; |
55
|
|
|
|
|
|
|
} |
56
|
132
|
|
|
|
|
545
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
GetOptionsFromArray(\@args, @options) |
59
|
|
|
|
|
|
|
|| pod2usage({ |
60
|
33
|
0
|
|
|
|
1024
|
-exitval => 1, |
|
|
50
|
|
|
|
|
|
61
|
|
|
|
|
|
|
-verbose => 99, |
62
|
|
|
|
|
|
|
-sections => $subcommand eq 'default' ? 'SYNOPSIS' : "SUBCOMMANDS/$subcommand/Usage", |
63
|
|
|
|
|
|
|
}); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
delete $args{$_} for grep { ! defined $args{$_} } keys %args; |
66
|
|
|
|
|
|
|
|
67
|
33
|
|
|
|
|
16220
|
\%args, |
|
171
|
|
|
|
|
375
|
|
68
|
|
|
|
|
|
|
} |
69
|
33
|
|
|
|
|
754
|
|
70
|
|
|
|
|
|
|
{ |
71
|
|
|
|
|
|
|
defined $ARGV[0] && $ARGV[0] !~ /^-/ |
72
|
|
|
|
|
|
|
? 'App::af::' . shift @ARGV |
73
|
|
|
|
|
|
|
: 'App::af::default'; |
74
|
3
|
100
|
100
|
3
|
0
|
8399
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
requires 'main'; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
use Moose; |
81
|
|
|
|
|
|
|
with 'App::af'; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
{ |
84
|
8
|
|
|
8
|
|
14481
|
say "App::af version @{[ $App::af::VERSION || 'dev' ]}"; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
49
|
|
85
|
|
|
|
|
|
|
say " af --help for usage information"; |
86
|
|
|
|
|
|
|
0; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
0
|
0
|
0
|
0
|
__PACKAGE__->meta->make_immutable; |
|
0
|
|
|
|
|
0
|
|
90
|
0
|
|
|
|
|
0
|
} |
91
|
0
|
|
|
|
|
0
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
use Moose::Role; |
94
|
|
|
|
|
|
|
use namespace::autoclean; |
95
|
|
|
|
|
|
|
use MooseX::Types::Path::Tiny qw( AbsPath ); |
96
|
|
|
|
|
|
|
use Path::Tiny qw( path ); |
97
|
|
|
|
|
|
|
use File::Temp qw( tempdir ); |
98
|
|
|
|
|
|
|
|
99
|
8
|
|
|
8
|
|
52421
|
has file => ( |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
61
|
|
100
|
8
|
|
|
8
|
|
36306
|
is => 'ro', |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
67
|
|
101
|
8
|
|
|
8
|
|
4629
|
isa => AbsPath, |
|
8
|
|
|
|
|
3411115
|
|
|
8
|
|
|
|
|
89
|
|
102
|
8
|
|
|
8
|
|
18827
|
traits => ['App::af::opt'], |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
468
|
|
103
|
8
|
|
|
8
|
|
5134
|
short => 'f', |
|
8
|
|
|
|
|
116405
|
|
|
8
|
|
|
|
|
3205
|
|
104
|
|
|
|
|
|
|
opt_type => 's', |
105
|
|
|
|
|
|
|
default => 'alienfile', |
106
|
|
|
|
|
|
|
coerce => 1, |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
has class => ( |
110
|
|
|
|
|
|
|
is => 'ro', |
111
|
|
|
|
|
|
|
isa => 'Str', |
112
|
|
|
|
|
|
|
traits => ['App::af::opt'], |
113
|
|
|
|
|
|
|
short => 'c', |
114
|
|
|
|
|
|
|
opt_type => 's', |
115
|
|
|
|
|
|
|
); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
{ |
118
|
|
|
|
|
|
|
my($self, %args) = @_; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
my $alienfile; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $prefix; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
$args{root} ||= tempdir( CLEANUP => 1); |
125
|
23
|
|
|
23
|
0
|
19793
|
|
126
|
|
|
|
|
|
|
if($self->class) |
127
|
23
|
|
|
|
|
49
|
{ |
128
|
|
|
|
|
|
|
my $class = $self->class =~ /::/ ? $self->class : "Alien::" . $self->class; |
129
|
|
|
|
|
|
|
my $pm = $class . '.pm'; |
130
|
|
|
|
|
|
|
$pm =~ s/::/\//g; |
131
|
23
|
|
66
|
|
|
148
|
require $pm; |
132
|
|
|
|
|
|
|
if($class->can('runtime_prop') && $class->runtime_prop) |
133
|
23
|
100
|
|
|
|
7045
|
{ |
134
|
|
|
|
|
|
|
my $dist = path($class->dist_dir); |
135
|
4
|
100
|
|
|
|
78
|
$alienfile = $dist->child('_alien/alienfile'); |
136
|
4
|
|
|
|
|
11
|
my $patch = $dist->child('_alien/patch'); |
137
|
4
|
|
|
|
|
16
|
$args{patch} = $patch->stringify if -d $patch; |
138
|
4
|
|
|
|
|
421
|
$prefix = $dist->stringify; |
139
|
4
|
50
|
33
|
|
|
38
|
} |
140
|
|
|
|
|
|
|
else |
141
|
4
|
|
|
|
|
3683
|
{ |
142
|
4
|
|
|
|
|
965
|
say STDERR "class @{[ $self->class ]} does not appear to have been installed using Alien::Build"; |
143
|
4
|
|
|
|
|
112
|
exit 2; |
144
|
4
|
50
|
|
|
|
101
|
} |
145
|
4
|
|
|
|
|
92
|
} |
146
|
|
|
|
|
|
|
else |
147
|
|
|
|
|
|
|
{ |
148
|
|
|
|
|
|
|
$alienfile = $self->file; |
149
|
0
|
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
150
|
0
|
|
|
|
|
0
|
|
151
|
|
|
|
|
|
|
unless(-r $alienfile) |
152
|
|
|
|
|
|
|
{ |
153
|
|
|
|
|
|
|
say STDERR "unable to read $alienfile"; |
154
|
|
|
|
|
|
|
exit 2; |
155
|
19
|
|
|
|
|
405
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
if(my $patch = $alienfile->parent->child('patch')) |
158
|
23
|
50
|
|
|
|
105
|
{ |
159
|
|
|
|
|
|
|
if(-d $patch) |
160
|
0
|
|
|
|
|
0
|
{ |
161
|
0
|
|
|
|
|
0
|
$args{patch} = "$patch"; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
23
|
50
|
|
|
|
488
|
|
165
|
|
|
|
|
|
|
require Alien::Build; |
166
|
23
|
50
|
|
|
|
1795
|
my $build = Alien::Build->load("$alienfile", %args); |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
wantarray ? ($build, $prefix) : $build; ## no critic (Community::Wantarray) |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
} |
172
|
23
|
|
|
|
|
3665
|
|
173
|
23
|
|
|
|
|
124770
|
|
174
|
|
|
|
|
|
|
use Moose::Role; |
175
|
23
|
100
|
|
|
|
156125
|
use namespace::autoclean; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
has phase => ( |
178
|
|
|
|
|
|
|
is => 'ro', |
179
|
|
|
|
|
|
|
isa => 'Str', |
180
|
|
|
|
|
|
|
default => 'all', |
181
|
|
|
|
|
|
|
traits => ['App::af::opt'], |
182
|
8
|
|
|
8
|
|
13055
|
opt_type => 's', |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
55
|
|
183
|
8
|
|
|
8
|
|
38404
|
short => 'p', |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
57
|
|
184
|
|
|
|
|
|
|
); |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
{ |
187
|
|
|
|
|
|
|
my($self) = @_; |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
if($self->phase !~ /^(configure|any|all|share|system)$/) |
190
|
|
|
|
|
|
|
{ |
191
|
|
|
|
|
|
|
say STDERR "unknown phase: @{[ $self->phase ]}"; |
192
|
|
|
|
|
|
|
exit 2; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
10
|
|
|
10
|
0
|
16
|
} |
197
|
|
|
|
|
|
|
|
198
|
10
|
50
|
|
|
|
218
|
|
199
|
|
|
|
|
|
|
use Moose::Role; |
200
|
0
|
|
|
|
|
|
use namespace::autoclean; |
|
0
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
use Path::Tiny qw( path ); |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
has I => ( |
204
|
|
|
|
|
|
|
is => 'ro', |
205
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
206
|
|
|
|
|
|
|
traits => ['App::af::opt'], |
207
|
|
|
|
|
|
|
opt_type => 's', |
208
|
|
|
|
|
|
|
is_array => 1, |
209
|
8
|
|
|
8
|
|
11575
|
); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
50
|
|
210
|
8
|
|
|
8
|
|
34764
|
|
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
38
|
|
211
|
8
|
|
|
8
|
|
492
|
has blib => ( |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
2024
|
|
212
|
|
|
|
|
|
|
is => 'ro', |
213
|
|
|
|
|
|
|
isa => 'Int', |
214
|
|
|
|
|
|
|
traits => ['App::af::opt'], |
215
|
|
|
|
|
|
|
); |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
around main => sub { |
218
|
|
|
|
|
|
|
my $orig = shift; |
219
|
|
|
|
|
|
|
my $self = shift; |
220
|
|
|
|
|
|
|
my @args = @_; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
local @INC = @INC; |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
foreach my $inc (reverse @{ $self->I }) |
225
|
|
|
|
|
|
|
{ |
226
|
|
|
|
|
|
|
require lib; |
227
|
|
|
|
|
|
|
lib->import($inc); |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
if($self->blib) |
231
|
|
|
|
|
|
|
{ |
232
|
|
|
|
|
|
|
require blib; |
233
|
|
|
|
|
|
|
blib->import; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
# make sure @INC entries are absolute, since $build |
237
|
|
|
|
|
|
|
# may do a lot of directory changes |
238
|
|
|
|
|
|
|
@INC = map { ref $_ ? $_ : path($_)->absolute->stringify } @INC; |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
$orig->($self, @args); |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
}; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
use Moose::Role; |
248
|
|
|
|
|
|
|
use namespace::autoclean; |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
has short => ( |
251
|
|
|
|
|
|
|
is => 'rw', |
252
|
|
|
|
|
|
|
isa => 'Str', |
253
|
|
|
|
|
|
|
default => '', |
254
|
|
|
|
|
|
|
); |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
has opt_type => ( |
257
|
|
|
|
|
|
|
is => 'rw', |
258
|
8
|
|
|
8
|
|
9026
|
isa => 'Str', |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
31
|
|
259
|
8
|
|
|
8
|
|
36081
|
default => '', |
|
8
|
|
|
|
|
150
|
|
|
8
|
|
|
|
|
43
|
|
260
|
|
|
|
|
|
|
); |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
has is_array => ( |
263
|
|
|
|
|
|
|
is => 'rw', |
264
|
|
|
|
|
|
|
isa => 'Int', |
265
|
|
|
|
|
|
|
lazy => 1, |
266
|
|
|
|
|
|
|
default => sub { |
267
|
|
|
|
|
|
|
my($self) = @_; |
268
|
|
|
|
|
|
|
int $self->opt_type =~ /\{/; |
269
|
|
|
|
|
|
|
}, |
270
|
|
|
|
|
|
|
); |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
1; |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=pod |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=encoding UTF-8 |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 NAME |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
App::af - Command line tool for alienfile |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head1 VERSION |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
version 0.18 |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head1 SYNOPSIS |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
af --help |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head1 DESCRIPTION |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
This class provides the machinery for the af command. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 SEE ALSO |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
L<af> |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head1 AUTHOR |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Author: Graham Ollis E<lt>plicease@cpan.orgE<gt> |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Contributors: |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Diab Jerius (DJERIUS) |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
This software is copyright (c) 2017-2022 by Graham Ollis. |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
314
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=cut |