line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Info::File; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
39935
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
4
|
use base 'Module::Info'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
812
|
|
6
|
1
|
|
|
1
|
|
6004
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
7
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
8
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
436
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.14'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new_from_file { |
13
|
2
|
|
|
2
|
1
|
7399
|
my ( $proto, $filename ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
2
|
50
|
|
|
|
337
|
open my $file, '<', $filename |
16
|
|
|
|
|
|
|
or croak "Unable to open file: $filename - $!"; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
4
|
my ( @packages, $version, $name, $dir ); |
19
|
2
|
|
|
|
|
71
|
while (<$file>) { |
20
|
20
|
100
|
|
|
|
57
|
if ( $_ =~ m/\bpackage\s?([A-Za-z0-9_:]+);/xm ) { |
21
|
2
|
50
|
|
|
|
12
|
if ($1) { |
22
|
2
|
|
|
|
|
6
|
$name = $1; |
23
|
|
|
|
|
|
|
} else { |
24
|
0
|
|
|
|
|
0
|
($name) = $file =~ m/(\w+\.pm)$/xm; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
20
|
|
|
|
|
1120
|
$dir = File::Spec->rel2abs($file); |
28
|
20
|
|
|
|
|
236
|
$dir =~ s[/(\w+\.p(m|l))$][]xm; |
29
|
|
|
|
|
|
|
|
30
|
20
|
100
|
|
|
|
54
|
if ( $_ =~ m/\bVERSION\b\s*=\s*'([0-9_.]+)'*;/xm ) { |
31
|
2
|
|
|
|
|
8
|
$version = $1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
20
|
100
|
33
|
|
|
195
|
if ( $name and $dir and $filename and $version ) { |
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
35
|
2
|
|
|
|
|
3
|
last; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
2
|
|
|
|
|
262
|
close $file; |
40
|
|
|
|
|
|
|
|
41
|
2
|
50
|
|
|
|
148
|
return __PACKAGE__->new_from_data( |
42
|
|
|
|
|
|
|
name => $name, |
43
|
|
|
|
|
|
|
dir => $dir, |
44
|
|
|
|
|
|
|
file => $filename, |
45
|
|
|
|
|
|
|
version => $version ? $version : undef, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub new_from_data { |
50
|
2
|
|
|
2
|
1
|
16
|
my ( $class, %params ) = @_; |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
33
|
|
|
19
|
my $self = bless {}, $class || ref $class; |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
10
|
foreach ( keys %params ) { |
55
|
8
|
|
50
|
|
|
34
|
$self->{$_} = $params{$_} || undef; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
2
|
50
|
|
|
|
8
|
if ( !$self->{'version'} ) { |
59
|
0
|
|
|
|
|
0
|
$self->{'version'} = $self->version(); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
17
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub version { |
66
|
2
|
|
|
2
|
1
|
10547
|
my ( $self, $version ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
2
|
50
|
|
|
|
11
|
if ($version) { |
69
|
0
|
|
|
|
|
0
|
$self->{version} = $version; |
70
|
0
|
|
|
|
|
0
|
return 1; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
2
|
50
|
|
|
|
8
|
if ( $self->{version} ) { |
74
|
2
|
|
|
|
|
21
|
return $self->{version}; |
75
|
|
|
|
|
|
|
} else { |
76
|
0
|
|
|
|
|
|
return $self->SUPER::version(); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |