line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
29224
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
|
|
|
|
|
|
package Module::Version::Loaded; |
4
|
|
|
|
|
|
|
$Module::Version::Loaded::VERSION = '0.000001'; |
5
|
1
|
|
|
1
|
|
402
|
use Module::Version 0.12 qw( get_version ); |
|
1
|
|
|
|
|
73366
|
|
|
1
|
|
|
|
|
68
|
|
6
|
1
|
|
|
|
|
7
|
use Sub::Exporter -setup => |
7
|
1
|
|
|
1
|
|
493
|
{ exports => [ 'versioned_inc', 'versioned_modules' ] }; |
|
1
|
|
|
|
|
9270
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub versioned_inc { |
10
|
1
|
|
|
1
|
1
|
8
|
my %versioned; |
11
|
1
|
|
|
|
|
47
|
foreach my $module ( keys %INC ) { |
12
|
102
|
|
|
|
|
188
|
my ( $version, undef ) = _module_version($module); |
13
|
102
|
|
|
|
|
56029
|
$versioned{$module} = $version; |
14
|
|
|
|
|
|
|
} |
15
|
1
|
|
|
|
|
103
|
return %versioned; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub versioned_modules { |
19
|
1
|
|
|
1
|
1
|
10
|
my %versioned; |
20
|
1
|
|
|
|
|
21
|
foreach my $file ( keys %INC ) { |
21
|
102
|
|
|
|
|
202
|
my ( $version, $module ) = _module_version($file); |
22
|
102
|
|
|
|
|
55302
|
$versioned{$module} = $version; |
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
|
|
102
|
return %versioned; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _module_version { |
28
|
204
|
|
|
204
|
|
240
|
my $module = shift; |
29
|
204
|
|
|
|
|
446
|
$module =~ s{/}{::}g; |
30
|
204
|
|
|
|
|
498
|
$module =~ s{\.pm\z}{}; |
31
|
204
|
|
|
|
|
394
|
return ( get_version($module), $module ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=encoding UTF-8 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Module::Version::Loaded - Get a versioned list of currently loaded modules |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 VERSION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
version 0.000001 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
use Module::Version::Loaded qw( versioned_modules ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my %modules = versioned_modules(); |
52
|
|
|
|
|
|
|
# %modules contains: ( Foo::Bar => 0.01, Bar::Foo => 1.99, ... ) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
BETA BETA BETA |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This module exists solely to give you a version of your %INC which includes the |
59
|
|
|
|
|
|
|
versions of the modules you have loaded. This is helpful when troubleshooting |
60
|
|
|
|
|
|
|
different environments. It makes it easier to see, at glance, which versions |
61
|
|
|
|
|
|
|
of modules you have actually loaded. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 FUNCTIONS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 versioned_modules |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns a C of module versions, which is keyed on module name. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
use Module::Version::Loaded qw( versioned_modules ); |
70
|
|
|
|
|
|
|
my %modules = versioned_modules(); |
71
|
|
|
|
|
|
|
# contains: |
72
|
|
|
|
|
|
|
... |
73
|
|
|
|
|
|
|
vars => 1.03, |
74
|
|
|
|
|
|
|
version => 0.9912, |
75
|
|
|
|
|
|
|
version::regex => 0.9912, |
76
|
|
|
|
|
|
|
version::vxs => 0.9912, |
77
|
|
|
|
|
|
|
... |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 versioned_inc |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Returns a C of module versions, which uses the same keys as %INC. This |
82
|
|
|
|
|
|
|
makes it easier to compare this data which %INC, since both Hashes will share |
83
|
|
|
|
|
|
|
the same keys. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
use Module::Version::Loaded qw( versioned_inc ); |
86
|
|
|
|
|
|
|
my %inc = versioned_inc(); |
87
|
|
|
|
|
|
|
# contains: |
88
|
|
|
|
|
|
|
... |
89
|
|
|
|
|
|
|
version.pm => 0.9912, |
90
|
|
|
|
|
|
|
version/regex.pm => 0.9912, |
91
|
|
|
|
|
|
|
version/vxs.pm => 0.9912, |
92
|
|
|
|
|
|
|
warnings.pm => 1.18, |
93
|
|
|
|
|
|
|
... |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
foreach my $key ( %INC ) { |
96
|
|
|
|
|
|
|
print "$key $INC{$key} $inc{$key}\n"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Olaf Alders |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by MaxMind, Inc.. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software, licensed under: |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
__END__ |