line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::ModuleDumper; |
2
|
9
|
|
|
9
|
|
50723
|
use strict; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
404
|
|
3
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
635
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our %seen; |
6
|
|
|
|
|
|
|
BEGIN { |
7
|
9
|
|
|
9
|
|
21027
|
%seen = %INC; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %pragmas; |
13
|
|
|
|
|
|
|
for my $pragma (qw/ |
14
|
|
|
|
|
|
|
charnames constant |
15
|
|
|
|
|
|
|
diagnostics |
16
|
|
|
|
|
|
|
encoding |
17
|
|
|
|
|
|
|
feature fields filetest |
18
|
|
|
|
|
|
|
if integer |
19
|
|
|
|
|
|
|
less lib locale |
20
|
|
|
|
|
|
|
mro |
21
|
|
|
|
|
|
|
open ops overload overloading |
22
|
|
|
|
|
|
|
parent |
23
|
|
|
|
|
|
|
re |
24
|
|
|
|
|
|
|
sigtrap sort strict subs |
25
|
|
|
|
|
|
|
threads threads::shared |
26
|
|
|
|
|
|
|
utf8 |
27
|
|
|
|
|
|
|
vars vmsish |
28
|
|
|
|
|
|
|
warnings warnings::register |
29
|
|
|
|
|
|
|
/) { |
30
|
|
|
|
|
|
|
$pragmas{$pragma} = 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our %skips; |
34
|
|
|
|
|
|
|
for my $class (qw/ |
35
|
|
|
|
|
|
|
AutoLoader |
36
|
|
|
|
|
|
|
Benchmark |
37
|
|
|
|
|
|
|
base |
38
|
|
|
|
|
|
|
bytes |
39
|
|
|
|
|
|
|
Config |
40
|
|
|
|
|
|
|
DynaLoader |
41
|
|
|
|
|
|
|
XSLoader |
42
|
|
|
|
|
|
|
/) { |
43
|
|
|
|
|
|
|
$skips{$class} = 1; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $ALL = $ENV{MODULEDUMPER_SHOW_ALL}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our $SHOWN = 0; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $CONF; |
51
|
|
|
|
|
|
|
sub import { |
52
|
9
|
|
|
9
|
|
207
|
my ($class) = shift; |
53
|
|
|
|
|
|
|
|
54
|
9
|
|
|
|
|
95
|
for my $opt (@_) { |
55
|
5
|
50
|
|
|
|
23
|
next unless $opt; |
56
|
5
|
50
|
|
|
|
46
|
if ($opt =~ m!^(show(?:all|seen|pragma|pragmas|skip|skips|pl))$!) { |
57
|
5
|
|
|
|
|
26
|
$CONF->{$1} = 1; |
58
|
5
|
|
|
|
|
190
|
next; |
59
|
|
|
|
|
|
|
} |
60
|
0
|
0
|
|
|
|
0
|
if ($opt eq '-stderr') { |
61
|
0
|
|
|
|
|
0
|
$CONF->{'-stderr'} = 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub show { |
67
|
19
|
|
|
19
|
1
|
16447
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
19
|
|
|
|
|
46
|
my $result = ''; |
70
|
|
|
|
|
|
|
|
71
|
19
|
100
|
|
|
|
107
|
return $result if $SHOWN; |
72
|
|
|
|
|
|
|
|
73
|
10
|
|
|
|
|
47
|
my $modules = _get_module_information(); |
74
|
|
|
|
|
|
|
|
75
|
10
|
|
|
|
|
59
|
$result .= "Perl\t$]\n"; |
76
|
|
|
|
|
|
|
|
77
|
10
|
|
|
|
|
23
|
for my $module (sort { uc($a) cmp uc($b) } keys %{$modules}) { |
|
1505
|
|
|
|
|
1826
|
|
|
10
|
|
|
|
|
218
|
|
78
|
341
|
|
|
|
|
768
|
$result .= sprintf "%s\t%s\n", $module, $modules->{$module}->{version}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
10
|
|
|
|
|
78
|
$SHOWN = 1; |
82
|
|
|
|
|
|
|
|
83
|
10
|
|
|
|
|
873
|
return $result; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _get_module_information { |
87
|
10
|
|
|
10
|
|
16
|
my %modules; |
88
|
10
|
|
|
|
|
412
|
for my $module_path (keys %INC) { |
89
|
815
|
|
|
|
|
1669
|
my $class = _path2class($module_path); |
90
|
815
|
100
|
66
|
|
|
3102
|
if (!$ALL && !$CONF->{showall}) { |
91
|
651
|
100
|
|
|
|
1053
|
next if _skip_to_show($module_path, $class); |
92
|
|
|
|
|
|
|
} |
93
|
341
|
|
|
|
|
679
|
$modules{$class} = { |
94
|
|
|
|
|
|
|
version => _get_version($class), |
95
|
|
|
|
|
|
|
}; |
96
|
|
|
|
|
|
|
} |
97
|
10
|
|
|
|
|
105
|
return \%modules; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _skip_to_show { |
101
|
651
|
|
|
651
|
|
907
|
my ($module_path, $class) = @_; |
102
|
|
|
|
|
|
|
|
103
|
651
|
100
|
100
|
|
|
11496
|
return 1 if (!$CONF->{showseen} && $seen{$module_path}) |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
104
|
|
|
|
|
|
|
|| (!$CONF->{showpl} && $module_path !~ m!\.pm$!) |
105
|
|
|
|
|
|
|
|| ((!$CONF->{showpragma} && !$CONF->{showpragmas}) && $pragmas{$class}) |
106
|
|
|
|
|
|
|
|| ((!$CONF->{skip} && !$CONF->{skips}) && $skips{$class}) |
107
|
|
|
|
|
|
|
|| $class eq __PACKAGE__; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _path2class { |
111
|
815
|
|
|
815
|
|
1156
|
my $path = shift; |
112
|
|
|
|
|
|
|
|
113
|
815
|
|
|
|
|
864
|
my $class = $path; |
114
|
815
|
|
|
|
|
1904
|
$class =~ s!/!::!g; |
115
|
815
|
|
|
|
|
2603
|
$class =~ s!\.pm$!!; |
116
|
|
|
|
|
|
|
|
117
|
815
|
|
|
|
|
1636
|
return $class; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub _get_version { |
121
|
341
|
|
|
341
|
|
406
|
my $module = shift; |
122
|
|
|
|
|
|
|
|
123
|
341
|
|
|
|
|
549
|
my $version = eval { |
124
|
341
|
|
|
|
|
5452
|
my $v = $module->VERSION; |
125
|
341
|
100
|
|
|
|
1137
|
unless (defined $v) { |
126
|
79
|
|
|
|
|
82
|
$v = ${"${module}::VERSION"}; |
|
79
|
|
|
|
|
572
|
|
127
|
|
|
|
|
|
|
} |
128
|
262
|
|
|
|
|
472
|
$v; |
129
|
|
|
|
|
|
|
}; |
130
|
341
|
100
|
66
|
|
|
1671
|
if ($@ || !defined $version) { |
131
|
79
|
|
|
|
|
101
|
$version = 'none'; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
341
|
|
|
|
|
1913
|
return $version; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
END { |
138
|
9
|
|
|
9
|
|
24989
|
my $info = __PACKAGE__->show; |
139
|
9
|
50
|
|
|
|
68
|
my $out = $CONF->{'-stderr'} ? *STDERR : *STDOUT; |
140
|
9
|
|
|
|
|
73
|
print $out "$info"; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
package # hide the package from the PAUSE indexer |
144
|
|
|
|
|
|
|
DB; |
145
|
9
|
|
|
9
|
|
267
|
no warnings 'redefine'; ## no critic |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
907
|
|
146
|
0
|
|
|
0
|
0
|
|
sub DB {} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
__END__ |