line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
17496
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package URI::cpan; |
5
|
|
|
|
|
|
|
# ABSTRACT: URLs that refer to things on the CPAN |
6
|
|
|
|
|
|
|
$URI::cpan::VERSION = '1.007'; |
7
|
1
|
|
|
1
|
|
354
|
use parent qw(URI::_generic); |
|
1
|
|
|
|
|
188
|
|
|
1
|
|
|
|
|
3
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
10
|
|
|
|
|
|
|
#pod |
11
|
|
|
|
|
|
|
#pod use URI::cpan; |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod my $uri = URI->new('cpan:///distfile/RJBS/URI-cpan-1.000.tar.gz'); |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod $uri->author; # => RJBS |
16
|
|
|
|
|
|
|
#pod $uri->dist_name; # => URI-cpan |
17
|
|
|
|
|
|
|
#pod $uri->dist_version; # => 1.000 |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod Other forms of cpan: URI include: |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod cpan:///author/RJBS |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod Reserved for likely future use are: |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod cpan:///dist |
26
|
|
|
|
|
|
|
#pod cpan:///module |
27
|
|
|
|
|
|
|
#pod cpan:///package |
28
|
|
|
|
|
|
|
#pod |
29
|
|
|
|
|
|
|
#pod =cut |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
2757
|
use Carp (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
32
|
1
|
|
|
1
|
|
242
|
use URI::cpan::author; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
33
|
1
|
|
|
1
|
|
261
|
use URI::cpan::dist; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
34
|
1
|
|
|
1
|
|
246
|
use URI::cpan::distfile; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
35
|
1
|
|
|
1
|
|
273
|
use URI::cpan::module; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
36
|
1
|
|
|
1
|
|
238
|
use URI::cpan::package; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
37
|
1
|
|
|
1
|
|
3
|
use URI::cpan::dist; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
156
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my %type_class = ( |
40
|
|
|
|
|
|
|
author => 'URI::cpan::author', |
41
|
|
|
|
|
|
|
distfile => 'URI::cpan::distfile', |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# These will be uncommented when we figure out what the heck to do with them. |
44
|
|
|
|
|
|
|
# -- rjbs, 2009-03-30 |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# dist => 'URI::cpan::dist', |
47
|
|
|
|
|
|
|
# package => 'URI::cpan::package', |
48
|
|
|
|
|
|
|
# module => 'URI::cpan::module', |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _init { |
52
|
4
|
|
|
4
|
|
1174
|
my $self = shift->SUPER::_init(@_); |
53
|
4
|
|
|
|
|
68
|
my $class = ref($self); |
54
|
|
|
|
|
|
|
|
55
|
4
|
50
|
|
|
|
10
|
Carp::croak "invalid cpan URI: non-empty query string not supported" |
56
|
|
|
|
|
|
|
if $self->query; |
57
|
|
|
|
|
|
|
|
58
|
4
|
50
|
|
|
|
97
|
Carp::croak "invalid cpan URI: non-empty fragment string not supported" |
59
|
|
|
|
|
|
|
if $self->fragment; |
60
|
|
|
|
|
|
|
|
61
|
4
|
|
|
|
|
25
|
my (undef, @path_parts) = split m{/}, $self->path; |
62
|
4
|
|
|
|
|
34
|
my $type = $path_parts[0]; |
63
|
|
|
|
|
|
|
|
64
|
4
|
50
|
|
|
|
11
|
Carp::croak "invalid cpan URI: do not understand path " . $self->path |
65
|
|
|
|
|
|
|
unless my $new_class = $type_class{ $type }; |
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
6
|
bless $self => $new_class; |
68
|
|
|
|
|
|
|
|
69
|
4
|
|
|
|
|
12
|
$self->validate; |
70
|
|
|
|
|
|
|
|
71
|
4
|
|
|
|
|
11
|
return $self; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _p_rel { |
75
|
12
|
|
|
12
|
|
7
|
my ($self) = @_; |
76
|
12
|
|
|
|
|
24
|
my $path = $self->path; |
77
|
12
|
|
|
|
|
185
|
$path =~ s{^/\w+/}{}; |
78
|
12
|
|
|
|
|
40
|
return $path; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#pod =head1 WARNINGS |
82
|
|
|
|
|
|
|
#pod |
83
|
|
|
|
|
|
|
#pod URI objects are difficult to subclass, so I have not (yet?) taken the time to |
84
|
|
|
|
|
|
|
#pod remove mutability from the objects. This means that you can probably alter a |
85
|
|
|
|
|
|
|
#pod URI::cpan object into a state where it is no longer valid. |
86
|
|
|
|
|
|
|
#pod |
87
|
|
|
|
|
|
|
#pod Please don't change the contents of these objects after construction. |
88
|
|
|
|
|
|
|
#pod |
89
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
90
|
|
|
|
|
|
|
#pod |
91
|
|
|
|
|
|
|
#pod L and L |
92
|
|
|
|
|
|
|
#pod |
93
|
|
|
|
|
|
|
#pod =head1 THANKS |
94
|
|
|
|
|
|
|
#pod |
95
|
|
|
|
|
|
|
#pod This code is derived from code written at Pobox.com by Hans Dieter Pearcey. |
96
|
|
|
|
|
|
|
#pod Dieter helped thrash out this new implementation, too. |
97
|
|
|
|
|
|
|
#pod |
98
|
|
|
|
|
|
|
#pod =cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |