line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package URI::cpan::distfile; |
5
|
|
|
|
|
|
|
# ABSTRACT: cpan:///distfile/AUTHOR/Dist-1.234.tar.gz |
6
|
|
|
|
|
|
|
$URI::cpan::distfile::VERSION = '1.007'; |
7
|
1
|
|
|
1
|
|
2
|
use parent qw(URI::cpan); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
37
|
use Carp (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
10
|
1
|
|
|
1
|
|
362
|
use CPAN::DistnameInfo; |
|
1
|
|
|
|
|
692
|
|
|
1
|
|
|
|
|
201
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod This URL refers to a file in an author directory on the CPAN, and expects the |
15
|
|
|
|
|
|
|
#pod format AUTHOR/DISTFILE |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod =head1 METHODS |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod =cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub validate { |
22
|
3
|
|
|
3
|
0
|
2
|
my ($self) = @_; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
9
|
my (undef, undef, $author, $filename) = split m{/}, $self->path, 4; |
25
|
|
|
|
|
|
|
|
26
|
3
|
50
|
|
|
|
100
|
Carp::croak "invalid cpan URI: invalid author part in $self" |
27
|
|
|
|
|
|
|
unless $author =~ m{\A[A-Z][-0-9A-Z]*\z}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#pod =head1 dist_name |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod This returns the name of the dist, like F or F. |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod =cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub dist_name { |
37
|
3
|
|
|
3
|
0
|
5
|
my ($self) = @_; |
38
|
3
|
|
|
|
|
6
|
my $dist = CPAN::DistnameInfo->new($self->_p_rel); |
39
|
3
|
|
|
|
|
144
|
my $name = $dist->dist; |
40
|
|
|
|
|
|
|
|
41
|
3
|
100
|
|
|
|
11
|
$name =~ s/-undef$// if ! defined $dist->version; |
42
|
|
|
|
|
|
|
|
43
|
3
|
|
|
|
|
23
|
return $name; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#pod =head1 dist_version |
47
|
|
|
|
|
|
|
#pod |
48
|
|
|
|
|
|
|
#pod This returns the version of the dist, or undef if the version can't be found or |
49
|
|
|
|
|
|
|
#pod is the string "undef" |
50
|
|
|
|
|
|
|
#pod |
51
|
|
|
|
|
|
|
#pod =cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub dist_version { |
54
|
3
|
|
|
3
|
0
|
4
|
my ($self) = @_; |
55
|
3
|
|
|
|
|
7
|
CPAN::DistnameInfo->new($self->_p_rel)->version; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#pod =head1 dist_filepath |
59
|
|
|
|
|
|
|
#pod |
60
|
|
|
|
|
|
|
#pod This returns the path to the dist file. This is the whole URL after the |
61
|
|
|
|
|
|
|
#pod C part. |
62
|
|
|
|
|
|
|
#pod |
63
|
|
|
|
|
|
|
#pod =cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub dist_filepath { |
66
|
1
|
|
|
1
|
0
|
339
|
my ($self) = @_; |
67
|
1
|
|
|
|
|
3
|
$self->_p_rel; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#pod =head1 author |
71
|
|
|
|
|
|
|
#pod |
72
|
|
|
|
|
|
|
#pod This returns the name of the author whose file is referred to. |
73
|
|
|
|
|
|
|
#pod |
74
|
|
|
|
|
|
|
#pod =cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub author { |
77
|
3
|
|
|
3
|
0
|
1129
|
my ($self) = @_; |
78
|
3
|
|
|
|
|
10
|
my ($author) = $self->_p_rel =~ m{^([A-Z]+)/}; |
79
|
3
|
|
|
|
|
9
|
return $author; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |