line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Version; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:XSAWYERX'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Get module versions |
4
|
|
|
|
|
|
|
$Module::Version::VERSION = '0.200'; |
5
|
5
|
|
|
5
|
|
87552
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
140
|
|
6
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
125
|
|
7
|
5
|
|
|
5
|
|
1660
|
use parent 'Exporter'; |
|
5
|
|
|
|
|
1099
|
|
|
5
|
|
|
|
|
25
|
|
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
260
|
use Carp qw< croak >; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
223
|
|
10
|
5
|
|
|
5
|
|
3699
|
use ExtUtils::MakeMaker; |
|
5
|
|
|
|
|
500465
|
|
|
5
|
|
|
|
|
936
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = 'get_version'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub get_version { |
15
|
12
|
100
|
|
12
|
1
|
2322
|
my $module = shift or croak 'Must get a module name'; |
16
|
11
|
|
|
|
|
68
|
my $file = MM->_installed_file_for_module($module); |
17
|
|
|
|
|
|
|
|
18
|
11
|
100
|
|
|
|
1448
|
$file || return; |
19
|
|
|
|
|
|
|
|
20
|
7
|
|
|
|
|
32
|
return MM->parse_version($file); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=encoding UTF-8 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Module::Version - Get module versions |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 VERSION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
version 0.200 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This module fetches the version of any other module. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
It comes with a CLI program C<mversion> which does the same. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use Module::Version 'get_version'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
print get_version('Search::GIN'), "\n"; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Or using C<mversion>: |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$ mversion Search::GIN |
52
|
|
|
|
|
|
|
0.04 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$ mversion Doesnt::Exist |
55
|
|
|
|
|
|
|
Warning: module 'Doesnt::Exist' does not seem to be installed. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$ mversion --quiet Doesnt::Exist |
58
|
|
|
|
|
|
|
(no output) |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$ mversion --full Search::GIN Moose |
61
|
|
|
|
|
|
|
Search::GIN 0.04 |
62
|
|
|
|
|
|
|
Moose 1.01 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$ mversion --input modules.txt |
65
|
|
|
|
|
|
|
Search::GIN 0.04 |
66
|
|
|
|
|
|
|
Data::Collector 0.03 |
67
|
|
|
|
|
|
|
Moose 1.01 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 EXPORT |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 get_version |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
C<get_version> will be exported if explicitly specified. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
use Module::Version 'get_version'; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
B<Nothing> is exported by default. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 get_version |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Accepts a module name and fetches the version of the module. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
If the module doesn't exist, returns undef. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 BUGS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please report bugs and other issues on the bugtracker: |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L<http://github.com/xsawyerx/module-version/issues> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SUPPORT |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This module sports 100% test coverage, but in case you have more issues, please |
96
|
|
|
|
|
|
|
see I<BUGS> above. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Sawyer X |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This software is copyright (c) 2010-2018 by Sawyer X. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
107
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |