line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package CPAN::DistnameInfo; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
$VERSION = "0.12"; |
5
|
2
|
|
|
2
|
|
81965
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1938
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub distname_info { |
8
|
590
|
100
|
|
590
|
0
|
1472
|
my $file = shift or return; |
9
|
|
|
|
|
|
|
|
10
|
587
|
50
|
|
|
|
9795
|
my ($dist, $version) = $file =~ /^ |
11
|
|
|
|
|
|
|
((?:[-+.]*(?:[A-Za-z0-9]+|(?<=\D)_|_(?=\D))* |
12
|
|
|
|
|
|
|
(?: |
13
|
|
|
|
|
|
|
[A-Za-z](?=[^A-Za-z]|$) |
14
|
|
|
|
|
|
|
| |
15
|
|
|
|
|
|
|
\d(?=-) |
16
|
|
|
|
|
|
|
)(?
|
17
|
|
|
|
|
|
|
)+)(.*) |
18
|
|
|
|
|
|
|
$/xs or return ($file,undef,undef); |
19
|
|
|
|
|
|
|
|
20
|
587
|
100
|
100
|
|
|
11845
|
if ($dist =~ /-undef\z/ and ! length $version) { |
21
|
1
|
|
|
|
|
4
|
$dist =~ s/-undef\z//; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Remove potential -withoutworldwriteables suffix |
25
|
587
|
|
|
|
|
892
|
$version =~ s/-withoutworldwriteables$//; |
26
|
|
|
|
|
|
|
|
27
|
587
|
100
|
|
|
|
1521
|
if ($version =~ /^(-[Vv].*)-(\d.*)/) { |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Catch names like Unicode-Collate-Standard-V3_1_1-0.1 |
30
|
|
|
|
|
|
|
# where the V3_1_1 is part of the distname |
31
|
1
|
|
|
|
|
3
|
$dist .= $1; |
32
|
1
|
|
|
|
|
3
|
$version = $2; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
587
|
100
|
|
|
|
1381
|
if ($version =~ /(.+_.*)-(\d.*)/) { |
36
|
|
|
|
|
|
|
# Catch names like Task-Deprecations5_14-1.00.tar.gz where the 5_14 is |
37
|
|
|
|
|
|
|
# part of the distname. However, names like libao-perl_0.03-1.tar.gz |
38
|
|
|
|
|
|
|
# should still have 0.03-1 as their version. |
39
|
1
|
|
|
|
|
3
|
$dist .= $1; |
40
|
1
|
|
|
|
|
3
|
$version = $2; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Normalize the Dist.pm-1.23 convention which CGI.pm and |
44
|
|
|
|
|
|
|
# a few others use. |
45
|
587
|
|
|
|
|
791
|
$dist =~ s{\.pm$}{}; |
46
|
|
|
|
|
|
|
|
47
|
587
|
50
|
66
|
|
|
2127
|
$version = $1 |
48
|
|
|
|
|
|
|
if !length $version and $dist =~ s/-(\d+\w)$//; |
49
|
|
|
|
|
|
|
|
50
|
587
|
100
|
100
|
|
|
2456
|
$version = $1 . $version |
51
|
|
|
|
|
|
|
if $version =~ /^\d+$/ and $dist =~ s/-(\w+)$//; |
52
|
|
|
|
|
|
|
|
53
|
587
|
100
|
|
|
|
1810
|
if ($version =~ /\d\.\d/) { |
54
|
487
|
|
|
|
|
2604
|
$version =~ s/^[-_.]+//; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
else { |
57
|
100
|
|
|
|
|
243
|
$version =~ s/^[-_]+//; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
587
|
|
|
|
|
883
|
my $dev; |
61
|
587
|
100
|
|
|
|
963
|
if (length $version) { |
62
|
558
|
100
|
100
|
|
|
3476
|
if ($file =~ /^perl-?\d+\.(\d+)(?:\D(\d+))?(-(?:TRIAL|RC)\d+)?$/) { |
|
|
100
|
|
|
|
|
|
63
|
5
|
100
|
66
|
|
|
662
|
$dev = 1 if (($1 > 6 and $1 & 1) or ($2 and $2 >= 50)) or $3; |
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
elsif ($version =~ /\d\D\d+_\d/ or $version =~ /-TRIAL/) { |
66
|
6
|
|
|
|
|
13
|
$dev = 1; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
29
|
|
|
|
|
37
|
$version = undef; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
587
|
|
|
|
|
2939
|
($dist, $version, $dev); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub new { |
77
|
590
|
|
|
590
|
0
|
452005
|
my $class = shift; |
78
|
590
|
|
|
|
|
884
|
my $distfile = shift; |
79
|
|
|
|
|
|
|
|
80
|
590
|
|
|
|
|
1388
|
$distfile =~ s,//+,/,g; |
81
|
|
|
|
|
|
|
|
82
|
590
|
|
|
|
|
1612
|
my %info = ( pathname => $distfile ); |
83
|
|
|
|
|
|
|
|
84
|
590
|
100
|
|
|
|
2380
|
($info{filename} = $distfile) =~ s,^(((.*?/)?authors/)?id/)?([A-Z])/(\4[A-Z])/(\5[-A-Z0-9]*)/,, |
85
|
|
|
|
|
|
|
and $info{cpanid} = $6; |
86
|
|
|
|
|
|
|
|
87
|
590
|
100
|
|
|
|
5927
|
if ($distfile =~ m,([^/]+)\.(tar\.(?:g?z|bz2)|zip|tgz)$,i) { # support more ? |
88
|
587
|
|
|
|
|
1986
|
$info{distvname} = $1; |
89
|
587
|
|
|
|
|
1270
|
$info{extension} = $2; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
590
|
|
|
|
|
7672
|
@info{qw(dist version beta)} = distname_info($info{distvname}); |
93
|
590
|
100
|
|
|
|
1866
|
$info{maturity} = delete $info{beta} ? 'developer' : 'released'; |
94
|
|
|
|
|
|
|
|
95
|
590
|
|
|
|
|
2524
|
return bless \%info, $class; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
590
|
|
|
590
|
1
|
17344
|
sub dist { shift->{dist} } |
99
|
590
|
|
|
590
|
1
|
16775
|
sub version { shift->{version} } |
100
|
590
|
|
|
590
|
1
|
14650
|
sub maturity { shift->{maturity} } |
101
|
30
|
|
|
30
|
1
|
13667
|
sub filename { shift->{filename} } |
102
|
29
|
|
|
29
|
1
|
12834
|
sub cpanid { shift->{cpanid} } |
103
|
30
|
|
|
30
|
1
|
9544
|
sub distvname { shift->{distvname} } |
104
|
30
|
|
|
30
|
1
|
15734
|
sub extension { shift->{extension} } |
105
|
30
|
|
|
30
|
1
|
13920
|
sub pathname { shift->{pathname} } |
106
|
|
|
|
|
|
|
|
107
|
30
|
|
|
30
|
1
|
130
|
sub properties { %{ $_[0] } } |
|
30
|
|
|
|
|
325
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |