line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package CPAN::DistnameInfo; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
$VERSION = "0.12_01"; |
5
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
6
|
2
|
|
|
2
|
|
39927
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
130
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub distname_info { |
9
|
593
|
50
|
|
593
|
0
|
921
|
my $file = shift or return; |
10
|
|
|
|
|
|
|
|
11
|
2
|
100
|
|
2
|
|
446
|
return ($file, undef, undef) if $file =~ /\P{ASCII}/; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
20
|
|
|
593
|
|
|
|
|
1165
|
|
12
|
|
|
|
|
|
|
|
13
|
592
|
50
|
|
|
|
5408
|
my ($dist, $version) = $file =~ /^ |
14
|
|
|
|
|
|
|
((?:[-+.]*(?:[A-Za-z0-9]+|(?<=\D)_|_(?=\D))* |
15
|
|
|
|
|
|
|
(?: |
16
|
|
|
|
|
|
|
[A-Za-z](?=[^A-Za-z]|$) |
17
|
|
|
|
|
|
|
| |
18
|
|
|
|
|
|
|
\d(?=-) |
19
|
|
|
|
|
|
|
)(?
|
20
|
|
|
|
|
|
|
)+)(.*) |
21
|
|
|
|
|
|
|
$/xs or return ($file,undef,undef); |
22
|
|
|
|
|
|
|
|
23
|
592
|
100
|
100
|
|
|
1194
|
if ($dist =~ /-undef\z/ and ! length $version) { |
24
|
1
|
|
|
|
|
5
|
$dist =~ s/-undef\z//; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Remove potential -withoutworldwriteables suffix |
28
|
592
|
|
|
|
|
474
|
$version =~ s/-withoutworldwriteables$//; |
29
|
|
|
|
|
|
|
|
30
|
592
|
100
|
|
|
|
779
|
if ($version =~ /^(-[Vv].*)-(\d.*)/) { |
31
|
|
|
|
|
|
|
# Catch names like Unicode-Collate-Standard-V3_1_1-0.1 |
32
|
|
|
|
|
|
|
# where the V3_1_1 is part of the distname |
33
|
1
|
|
|
|
|
3
|
$dist .= $1; |
34
|
1
|
|
|
|
|
2
|
$version = $2; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
592
|
100
|
|
|
|
887
|
if ($version =~ /(.+_.*)-(\d.*)/) { |
38
|
|
|
|
|
|
|
# Catch names like Task-Deprecations5_14-1.00.tar.gz where the 5_14 is |
39
|
|
|
|
|
|
|
# part of the distname. However, names like libao-perl_0.03-1.tar.gz |
40
|
|
|
|
|
|
|
# should still have 0.03-1 as their version. |
41
|
1
|
|
|
|
|
3
|
$dist .= $1; |
42
|
1
|
|
|
|
|
3
|
$version = $2; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Normalize the Dist.pm-1.23 convention which CGI.pm and |
46
|
|
|
|
|
|
|
# a few others use. |
47
|
592
|
|
|
|
|
487
|
$dist =~ s{\.pm$}{}; |
48
|
|
|
|
|
|
|
|
49
|
592
|
50
|
66
|
|
|
1288
|
$version = $1 |
50
|
|
|
|
|
|
|
if !length $version and $dist =~ s/-(\d+\w)$//; |
51
|
|
|
|
|
|
|
|
52
|
592
|
100
|
100
|
|
|
1340
|
$version = $1 . $version |
53
|
|
|
|
|
|
|
if $version =~ /^\d+$/ and $dist =~ s/-(\w+)$//; |
54
|
|
|
|
|
|
|
|
55
|
592
|
100
|
|
|
|
1250
|
if ($version =~ /\d\.\d/) { |
56
|
492
|
|
|
|
|
1152
|
$version =~ s/^[-_.]+//; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else { |
59
|
100
|
|
|
|
|
170
|
$version =~ s/^[-_]+//; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
592
|
|
|
|
|
487
|
my $dev; |
63
|
592
|
100
|
|
|
|
654
|
if (length $version) { |
64
|
563
|
100
|
100
|
|
|
2359
|
if ($file =~ /^perl-?\d+\.(\d+)(?:\D(\d+))?(-(?:TRIAL|RC)\d+)?$/) { |
|
|
100
|
|
|
|
|
|
65
|
5
|
100
|
66
|
|
|
61
|
$dev = 1 if (($1 > 6 and $1 & 1) or ($2 and $2 >= 50)) or $3; |
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
elsif ($version =~ /\d\D\d+_\d/ or $version =~ s/-TRIAL[0-9]*$//) { |
68
|
8
|
|
|
|
|
9
|
$dev = 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
29
|
|
|
|
|
28
|
$version = undef; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
592
|
|
|
|
|
1777
|
($dist, $version, $dev); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub new { |
79
|
593
|
|
|
593
|
0
|
198609
|
my $class = shift; |
80
|
593
|
|
|
|
|
485
|
my $distfile = shift; |
81
|
|
|
|
|
|
|
|
82
|
593
|
|
|
|
|
747
|
$distfile =~ s,//+,/,g; |
83
|
|
|
|
|
|
|
|
84
|
593
|
|
|
|
|
935
|
my %info = ( pathname => $distfile ); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
($info{filename} = $distfile) =~ s,^(((.*?/)?authors/)?id/)?([A-Z])/(\4[A-Z])/(\5[-A-Z0-9]*)/,, |
87
|
593
|
100
|
|
|
|
1666
|
and $info{cpanid} = $6; |
88
|
|
|
|
|
|
|
|
89
|
593
|
50
|
|
|
|
2804
|
if ($distfile =~ m,([^/]+)\.(tar\.(?:g?z|bz2|xz)|zip|tgz)$,i) { # support more ? |
90
|
593
|
|
|
|
|
1102
|
$info{distvname} = $1; |
91
|
593
|
|
|
|
|
767
|
$info{extension} = $2; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
593
|
|
|
|
|
984
|
@info{qw(dist version beta)} = distname_info($info{distvname}); |
95
|
593
|
100
|
|
|
|
1057
|
$info{maturity} = delete $info{beta} ? 'developer' : 'released'; |
96
|
|
|
|
|
|
|
|
97
|
593
|
|
|
|
|
1131
|
return bless \%info, $class; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
593
|
|
|
593
|
1
|
7837
|
sub dist { shift->{dist} } |
101
|
593
|
|
|
593
|
1
|
7062
|
sub version { shift->{version} } |
102
|
593
|
|
|
593
|
1
|
6883
|
sub maturity { shift->{maturity} } |
103
|
30
|
|
|
30
|
1
|
6265
|
sub filename { shift->{filename} } |
104
|
29
|
|
|
29
|
1
|
6340
|
sub cpanid { shift->{cpanid} } |
105
|
30
|
|
|
30
|
1
|
7137
|
sub distvname { shift->{distvname} } |
106
|
30
|
|
|
30
|
1
|
5078
|
sub extension { shift->{extension} } |
107
|
30
|
|
|
30
|
1
|
5669
|
sub pathname { shift->{pathname} } |
108
|
|
|
|
|
|
|
|
109
|
30
|
|
|
30
|
1
|
74
|
sub properties { %{ $_[0] } } |
|
30
|
|
|
|
|
158
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
__END__ |