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