line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Info::File; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
79597
|
use strict; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Module::Info'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
599
|
|
6
|
1
|
|
|
1
|
|
6906
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
53
|
|
7
|
1
|
|
|
1
|
|
6
|
use File::Basename; # fileparse |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
52
|
|
8
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
9
|
1
|
|
|
1
|
|
595
|
use Module::Metadata; |
|
1
|
|
|
|
|
6093
|
|
|
1
|
|
|
|
|
41
|
|
10
|
1
|
|
|
1
|
|
510
|
use Try::Tiny; # try catch |
|
1
|
|
|
|
|
1983
|
|
|
1
|
|
|
|
|
303
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '1.01'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new_from_file { |
15
|
5
|
|
|
5
|
1
|
5064
|
my ( $proto, $filepath ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
27
|
my $info = Module::Metadata->new_from_file($filepath); |
18
|
5
|
|
|
|
|
9735
|
my ($filename, $dir, $suffix) = fileparse($filepath); |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
23
|
return __PACKAGE__->new_from_data( |
21
|
|
|
|
|
|
|
name => $info->name, |
22
|
|
|
|
|
|
|
dir => $dir, |
23
|
|
|
|
|
|
|
file => $filename, |
24
|
|
|
|
|
|
|
version => $info->version, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new_from_data { |
29
|
5
|
|
|
5
|
1
|
97
|
my ( $class, %params ) = @_; |
30
|
|
|
|
|
|
|
|
31
|
5
|
|
33
|
|
|
18
|
my $self = bless {}, $class || ref $class; |
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
|
|
16
|
foreach ( keys %params ) { |
34
|
20
|
|
100
|
|
|
95
|
$self->{$_} = $params{$_} || undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
5
|
100
|
|
|
|
27
|
if ( !$self->{'version'} ) { |
38
|
2
|
|
|
|
|
6
|
$self->{'version'} = $self->version(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
50
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub version { |
45
|
9
|
|
|
9
|
1
|
5258
|
my ( $self, $version ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
9
|
100
|
|
|
|
27
|
if ($version) { |
48
|
1
|
|
|
|
|
3
|
$self->{version} = $version; |
49
|
1
|
|
|
|
|
5
|
return 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
8
|
100
|
|
|
|
56
|
if ( $self->{version} ) { |
53
|
4
|
|
|
|
|
40
|
return $self->{version}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
else { |
56
|
|
|
|
|
|
|
try { |
57
|
4
|
|
|
4
|
|
197
|
return $self->SUPER::version(); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} catch { |
60
|
4
|
|
|
4
|
|
308
|
return undef; |
61
|
4
|
|
|
|
|
32
|
}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |