line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Info::File; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24784
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
3
|
use base 'Module::Info'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
453
|
|
6
|
1
|
|
|
1
|
|
5973
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
7
|
1
|
|
|
1
|
|
4
|
use File::Basename; # fileparse |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
51
|
|
8
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
9
|
1
|
|
|
1
|
|
506
|
use Module::Metadata; |
|
1
|
|
|
|
|
3849
|
|
|
1
|
|
|
|
|
33
|
|
10
|
1
|
|
|
1
|
|
434
|
use Try::Tiny; # try catch |
|
1
|
|
|
|
|
960
|
|
|
1
|
|
|
|
|
239
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '1.00'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new_from_file { |
15
|
4
|
|
|
4
|
1
|
1765
|
my ( $proto, $filepath ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
|
|
21
|
my $info = Module::Metadata->new_from_file($filepath); |
18
|
4
|
|
|
|
|
4960
|
my ($filename, $dir, $suffix) = fileparse($filepath); |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
13
|
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
|
4
|
|
|
4
|
1
|
57
|
my ( $class, %params ) = @_; |
30
|
|
|
|
|
|
|
|
31
|
4
|
|
33
|
|
|
14
|
my $self = bless {}, $class || ref $class; |
32
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
10
|
foreach ( keys %params ) { |
34
|
16
|
|
100
|
|
|
70
|
$self->{$_} = $params{$_} || undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
4
|
100
|
|
|
|
23
|
if ( !$self->{'version'} ) { |
38
|
1
|
|
|
|
|
3
|
$self->{'version'} = $self->version(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
4
|
|
|
|
|
39
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub version { |
45
|
5
|
|
|
5
|
1
|
2660
|
my ( $self, $version ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
5
|
50
|
|
|
|
11
|
if ($version) { |
48
|
0
|
|
|
|
|
0
|
$self->{version} = $version; |
49
|
0
|
|
|
|
|
0
|
return 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
5
|
100
|
|
|
|
31
|
if ( $self->{version} ) { |
53
|
3
|
|
|
|
|
16
|
return $self->{version}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
else { |
56
|
|
|
|
|
|
|
try { |
57
|
2
|
|
|
2
|
|
66
|
my $version = $self->SUPER::version(); |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
0
|
if ($version) { |
60
|
0
|
|
|
|
|
0
|
return $version; |
61
|
|
|
|
|
|
|
} else { |
62
|
0
|
|
|
|
|
0
|
return undef; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} catch { |
65
|
2
|
|
|
2
|
|
110
|
return undef; |
66
|
2
|
|
|
|
|
15
|
}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |