line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
800105
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
3
|
|
|
|
|
|
|
package Module::Version::Loaded; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000002'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
395
|
use Module::Version 0.12 qw( get_version ); |
|
1
|
|
|
|
|
79597
|
|
|
1
|
|
|
|
|
74
|
|
8
|
1
|
|
|
|
|
7
|
use Sub::Exporter -setup => { |
9
|
|
|
|
|
|
|
exports => [ |
10
|
|
|
|
|
|
|
'diff_versioned_modules', |
11
|
|
|
|
|
|
|
'store_versioned_modules', |
12
|
|
|
|
|
|
|
'versioned_inc', |
13
|
|
|
|
|
|
|
'versioned_modules', |
14
|
|
|
|
|
|
|
] |
15
|
1
|
|
|
1
|
|
501
|
}; |
|
1
|
|
|
|
|
7755
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub versioned_inc { |
18
|
1
|
|
|
1
|
1
|
7
|
my %versioned; |
19
|
1
|
|
|
|
|
46
|
foreach my $module ( keys %INC ) { |
20
|
110
|
|
|
|
|
228
|
my ( $version, undef ) = _module_version($module); |
21
|
110
|
|
|
|
|
69468
|
$versioned{$module} = $version; |
22
|
|
|
|
|
|
|
} |
23
|
1
|
|
|
|
|
159
|
return %versioned; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub versioned_modules { |
27
|
3
|
|
|
3
|
1
|
15
|
my %versioned; |
28
|
3
|
|
|
|
|
106
|
foreach my $file ( keys %INC ) { |
29
|
332
|
|
|
|
|
577
|
my ( $version, $module ) = _module_version($file); |
30
|
332
|
|
|
|
|
183374
|
$versioned{$module} = $version; |
31
|
|
|
|
|
|
|
} |
32
|
3
|
|
|
|
|
383
|
return %versioned; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub diff_versioned_modules { |
36
|
0
|
|
0
|
0
|
1
|
0
|
my $file1 = shift || '2 file names required'; |
37
|
0
|
|
0
|
|
|
0
|
my $file2 = shift || '2 file names required'; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
require Data::Difflet; |
40
|
0
|
|
|
|
|
0
|
require Storable; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
0
|
print Data::Difflet->new->compare( |
43
|
|
|
|
|
|
|
Storable::retrieve($file1), |
44
|
|
|
|
|
|
|
Storable::retrieve($file2) |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub store_versioned_modules { |
49
|
2
|
|
50
|
2
|
1
|
49518
|
my $file = shift || die 'file name required'; |
50
|
2
|
|
|
|
|
8
|
my %versioned = versioned_modules(); |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
636
|
require Storable; |
53
|
2
|
|
|
|
|
2802
|
Storable::nstore( \%versioned, $file ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _module_version { |
57
|
442
|
|
|
442
|
|
561
|
my $module = shift; |
58
|
442
|
|
|
|
|
981
|
$module =~ s{/}{::}g; |
59
|
442
|
|
|
|
|
1164
|
$module =~ s{\.pm\z}{}; |
60
|
442
|
|
100
|
|
|
899
|
return ( get_version($module) || undef, $module ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=pod |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=encoding UTF-8 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Module::Version::Loaded - Get a versioned list of currently loaded modules |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
version 0.000002 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use Module::Version::Loaded qw( versioned_modules ); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my %modules = versioned_modules(); |
81
|
|
|
|
|
|
|
# %modules contains: ( Foo::Bar => 0.01, Bar::Foo => 1.99, ... ) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 DESCRIPTION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
BETA BETA BETA |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This module exists solely to give you a version of your %INC which includes the |
88
|
|
|
|
|
|
|
versions of the modules you have loaded. This is helpful when troubleshooting |
89
|
|
|
|
|
|
|
different environments. It makes it easier to see, at glance, which versions |
90
|
|
|
|
|
|
|
of modules you have actually loaded. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 FUNCTIONS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 versioned_modules |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns a C of module versions, which is keyed on module name. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
use Module::Version::Loaded qw( versioned_modules ); |
99
|
|
|
|
|
|
|
my %modules = versioned_modules(); |
100
|
|
|
|
|
|
|
# contains: |
101
|
|
|
|
|
|
|
... |
102
|
|
|
|
|
|
|
vars => 1.03, |
103
|
|
|
|
|
|
|
version => 0.9912, |
104
|
|
|
|
|
|
|
version::regex => 0.9912, |
105
|
|
|
|
|
|
|
version::vxs => 0.9912, |
106
|
|
|
|
|
|
|
... |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 versioned_inc |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Returns a C of module versions, which uses the same keys as %INC. This |
111
|
|
|
|
|
|
|
makes it easier to compare this data which %INC, since both Hashes will share |
112
|
|
|
|
|
|
|
the same keys. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
use Module::Version::Loaded qw( versioned_inc ); |
115
|
|
|
|
|
|
|
my %inc = versioned_inc(); |
116
|
|
|
|
|
|
|
# contains: |
117
|
|
|
|
|
|
|
... |
118
|
|
|
|
|
|
|
version.pm => 0.9912, |
119
|
|
|
|
|
|
|
version/regex.pm => 0.9912, |
120
|
|
|
|
|
|
|
version/vxs.pm => 0.9912, |
121
|
|
|
|
|
|
|
warnings.pm => 1.18, |
122
|
|
|
|
|
|
|
... |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
foreach my $key ( %INC ) { |
125
|
|
|
|
|
|
|
print "$key $INC{$key} $inc{$key}\n"; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 store_versioned_modules( $file ) |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Serializes your versioned module list to an arbitrary file name which you must |
131
|
|
|
|
|
|
|
provide. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 diff_versioned_modules( $file1, $file2 ) |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Requires the name of two files, which have previously been serialized via |
136
|
|
|
|
|
|
|
C. Uses C to print a comparison of |
137
|
|
|
|
|
|
|
these data structures to STDOUT. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Olaf Alders |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by MaxMind, Inc.. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This is free software, licensed under: |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
__END__ |