| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::palien; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
380
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
25
|
|
|
4
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
5
|
1
|
|
|
1
|
|
594
|
use Getopt::Long qw( GetOptions ); |
|
|
1
|
|
|
|
|
7424
|
|
|
|
1
|
|
|
|
|
6
|
|
|
6
|
1
|
|
|
1
|
|
57610
|
use Pod::Usage qw( pod2usage ); |
|
|
1
|
|
|
|
|
39519
|
|
|
|
1
|
|
|
|
|
65
|
|
|
7
|
1
|
|
|
1
|
|
390
|
use Path::Class qw( file dir ); |
|
|
1
|
|
|
|
|
26423
|
|
|
|
1
|
|
|
|
|
810
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Command line interface to Alien::Base |
|
10
|
|
|
|
|
|
|
our $VERSION = '0.02'; # VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _version ($) |
|
14
|
|
|
|
|
|
|
{ |
|
15
|
0
|
|
|
0
|
|
|
my($alien) = @_; |
|
16
|
0
|
|
|
|
|
|
my $class = ref $alien; |
|
17
|
0
|
|
|
|
|
|
eval qq{ \$$class\::VERSION }; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _modversion ($) |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
0
|
|
|
0
|
|
|
my($alien) = @_; |
|
23
|
0
|
0
|
|
|
|
|
return $alien->version if $alien->can('version'); |
|
24
|
0
|
0
|
|
|
|
|
return 'unknown' unless $alien->can('config'); |
|
25
|
0
|
|
|
|
|
|
my $ver = $alien->config('version'); |
|
26
|
0
|
|
|
|
|
|
chomp $ver; |
|
27
|
0
|
|
|
|
|
|
$ver; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _cflags ($) |
|
31
|
|
|
|
|
|
|
{ |
|
32
|
0
|
|
|
0
|
|
|
my($alien) = @_; |
|
33
|
0
|
|
|
|
|
|
scalar $alien->cflags; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _libs ($) |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
0
|
|
|
0
|
|
|
my($alien) = @_; |
|
39
|
0
|
|
|
|
|
|
scalar $alien->libs; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub main |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
0
|
|
|
0
|
0
|
|
local(undef, @ARGV) = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $cflags; |
|
47
|
|
|
|
|
|
|
my $libs; |
|
48
|
0
|
|
|
|
|
|
my $list; |
|
49
|
0
|
|
|
|
|
|
my $dll; |
|
50
|
0
|
|
|
|
|
|
my $modversion; |
|
51
|
0
|
|
|
|
|
|
my $detail; |
|
52
|
0
|
|
|
|
|
|
my $status = 0; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
GetOptions( |
|
55
|
|
|
|
|
|
|
"cflags" => \$cflags, |
|
56
|
|
|
|
|
|
|
"libs" => \$libs, |
|
57
|
|
|
|
|
|
|
"dll" => \$dll, |
|
58
|
|
|
|
|
|
|
"modversion" => \$modversion, |
|
59
|
|
|
|
|
|
|
"detail|d" => \$detail, |
|
60
|
0
|
|
|
0
|
|
|
"help|h" => sub { pod2usage({ -verbose => 2}) }, |
|
61
|
0
|
|
0
|
0
|
|
|
"version" => sub { print "App::palien version " . ($App::palien::VERSION || 'dev') . "\n"; exit 1; }, |
|
|
0
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
) || pod2usage(1); |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
unless(@ARGV) |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
0
|
|
|
|
|
|
my %mods; |
|
67
|
0
|
|
|
|
|
|
foreach my $inc (@INC) |
|
68
|
|
|
|
|
|
|
{ |
|
69
|
0
|
|
|
|
|
|
my $dir = dir( $inc, 'Alien' ); |
|
70
|
0
|
0
|
|
|
|
|
next unless -d $dir; |
|
71
|
0
|
|
|
|
|
|
$DB::single = 1; |
|
72
|
0
|
|
|
|
|
|
foreach my $pm (grep /\.pm$/, map { $_->basename } grep { ! $_->is_dir } $dir->children) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
{ |
|
74
|
0
|
|
|
|
|
|
$pm =~ s/\.pm$//; |
|
75
|
0
|
0
|
|
|
|
|
next if $pm =~ /^(Base|Packages)$/; |
|
76
|
0
|
|
|
|
|
|
$mods{"Alien::$pm"} = 1; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $share_root = dir( $inc, qw( auto share dist ) ); |
|
80
|
0
|
0
|
|
|
|
|
next unless -d $share_root; |
|
81
|
0
|
|
|
|
|
|
foreach my $share ($share_root->children) |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
0
|
|
|
|
|
|
my $readme = $share->file('README'); |
|
84
|
0
|
0
|
0
|
|
|
|
next unless (-r $readme) && ($readme->slurp =~ /This README file is autogenerated by Alien::Base/); |
|
85
|
0
|
|
|
|
|
|
my $module = $share->basename; |
|
86
|
0
|
|
|
|
|
|
$module =~ s/-/::/g; |
|
87
|
0
|
|
|
|
|
|
$mods{$module} = 1; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
@ARGV = sort keys %mods; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
foreach my $module (@ARGV) |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
0
|
|
|
|
|
|
my $alien; |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
if($module =~ /::/) |
|
100
|
|
|
|
|
|
|
{ |
|
101
|
0
|
|
|
|
|
|
$alien = eval qq{ require $module; $module->new }; |
|
102
|
0
|
0
|
|
|
|
|
if($@) |
|
103
|
|
|
|
|
|
|
{ |
|
104
|
0
|
|
|
|
|
|
warn "unable to load $module: $@"; |
|
105
|
0
|
|
|
|
|
|
$status = 2; |
|
106
|
0
|
|
|
|
|
|
next; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
else |
|
110
|
|
|
|
|
|
|
{ |
|
111
|
0
|
|
|
|
|
|
$alien = find($module); |
|
112
|
0
|
0
|
|
|
|
|
next unless $alien; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
0
|
0
|
|
|
|
|
if($detail) |
|
116
|
|
|
|
|
|
|
{ |
|
117
|
0
|
|
|
|
|
|
my $class = ref $alien; |
|
118
|
0
|
|
|
|
|
|
printf "=============================================\n"; |
|
119
|
0
|
|
|
|
|
|
printf "class: %s\n", ref $alien; |
|
120
|
0
|
|
|
|
|
|
printf "version: %s\n", _version $alien; |
|
121
|
0
|
|
|
|
|
|
printf "modversion: %s\n", _modversion $alien; |
|
122
|
0
|
0
|
|
|
|
|
printf "dist: %s\n", $alien->dist_dir if eval { $alien->dist_dir }; |
|
|
0
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
printf "cflags: %s\n", _cflags $alien; |
|
124
|
0
|
|
|
|
|
|
printf "libs: %s\n", _libs $alien; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
if($cflags) |
|
128
|
|
|
|
|
|
|
{ |
|
129
|
0
|
|
|
|
|
|
print _cflags $alien, "\n"; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
if($libs) |
|
133
|
|
|
|
|
|
|
{ |
|
134
|
0
|
|
|
|
|
|
print _libs $alien, "\n"; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
0
|
0
|
|
|
|
|
if($modversion) |
|
138
|
|
|
|
|
|
|
{ |
|
139
|
0
|
|
|
|
|
|
print _modversion $alien, "\n"; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
0
|
|
|
|
|
if($dll) |
|
143
|
|
|
|
|
|
|
{ |
|
144
|
0
|
|
|
|
|
|
print $_, "\n" for $alien->dynamic_libs; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
$status; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
my $byname; |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub find |
|
154
|
|
|
|
|
|
|
{ |
|
155
|
0
|
|
|
0
|
0
|
|
my($q) = @_; |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
0
|
|
|
|
|
unless($byname) |
|
158
|
|
|
|
|
|
|
{ |
|
159
|
0
|
|
|
|
|
|
$byname->{libarchive} = 'Alien::Libarchive'; |
|
160
|
0
|
|
|
|
|
|
$byname->{bz2} = 'Alien::bz2'; |
|
161
|
0
|
|
|
|
|
|
foreach my $inc (@INC) |
|
162
|
|
|
|
|
|
|
{ |
|
163
|
0
|
|
|
|
|
|
my $share_root = dir( $inc, qw( auto share dist ) ); |
|
164
|
0
|
0
|
|
|
|
|
next unless -d $share_root; |
|
165
|
0
|
|
|
|
|
|
foreach my $share ($share_root->children) |
|
166
|
|
|
|
|
|
|
{ |
|
167
|
0
|
|
|
|
|
|
my $readme = $share->file('README'); |
|
168
|
0
|
0
|
0
|
|
|
|
next unless (-r $readme) && ($readme->slurp =~ /This README file is autogenerated by Alien::Base/); |
|
169
|
0
|
|
|
|
|
|
my $module = $share->basename; |
|
170
|
0
|
|
|
|
|
|
$module =~ s/-/::/g; |
|
171
|
0
|
|
|
|
|
|
my $name = eval qq{ require $module\::ConfigData; $module\::ConfigData->config('name'); }; |
|
172
|
0
|
|
|
|
|
|
$byname->{$name} = $module; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
|
my $module = $byname->{$q}; |
|
178
|
|
|
|
|
|
|
|
|
179
|
0
|
0
|
0
|
|
|
|
defined $module ? eval qq{ require $module; $module->new } || warn "unable to load $module: $@" && () : (); |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
1; |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
__END__ |