line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::news; # draft-gilman-news-url-01 |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
94
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '5.20'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
434
|
use parent 'URI::_server'; |
|
2
|
|
|
|
|
320
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
109
|
use URI::Escape qw(uri_unescape); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
106
|
|
11
|
2
|
|
|
2
|
|
13
|
use Carp (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1070
|
|
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
1
|
10
|
sub default_port { 119 } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# newsURL = scheme ":" [ news-server ] [ refbygroup | message ] |
16
|
|
|
|
|
|
|
# scheme = "news" | "snews" | "nntp" |
17
|
|
|
|
|
|
|
# news-server = "//" server "/" |
18
|
|
|
|
|
|
|
# refbygroup = group [ "/" messageno [ "-" messageno ] ] |
19
|
|
|
|
|
|
|
# message = local-part "@" domain |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _group |
22
|
|
|
|
|
|
|
{ |
23
|
18
|
|
|
18
|
|
29
|
my $self = shift; |
24
|
18
|
|
|
|
|
49
|
my $old = $self->path; |
25
|
18
|
100
|
|
|
|
49
|
if (@_) { |
26
|
4
|
|
|
|
|
10
|
my($group,$from,$to) = @_; |
27
|
4
|
100
|
|
|
|
15
|
if ($group =~ /\@/) { |
28
|
2
|
|
|
|
|
9
|
$group =~ s/^<(.*)>$/$1/; # "<" and ">" should not be part of it |
29
|
|
|
|
|
|
|
} |
30
|
4
|
|
|
|
|
8
|
$group =~ s,%,%25,g; |
31
|
4
|
|
|
|
|
5
|
$group =~ s,/,%2F,g; |
32
|
4
|
|
|
|
|
8
|
my $path = $group; |
33
|
4
|
100
|
|
|
|
9
|
if (defined $from) { |
34
|
1
|
|
|
|
|
3
|
$path .= "/$from"; |
35
|
1
|
50
|
|
|
|
14
|
$path .= "-$to" if defined $to; |
36
|
|
|
|
|
|
|
} |
37
|
4
|
|
|
|
|
16
|
$self->path($path); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
18
|
|
|
|
|
44
|
$old =~ s,^/,,; |
41
|
18
|
100
|
100
|
|
|
97
|
if ($old !~ /\@/ && $old =~ s,/(.*),, && wantarray) { |
|
|
|
100
|
|
|
|
|
42
|
2
|
|
|
|
|
11
|
my $extra = $1; |
43
|
2
|
|
|
|
|
7
|
return (uri_unescape($old), split(/-/, $extra)); |
44
|
|
|
|
|
|
|
} |
45
|
16
|
|
|
|
|
41
|
uri_unescape($old); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub group |
50
|
|
|
|
|
|
|
{ |
51
|
12
|
|
|
12
|
0
|
39
|
my $self = shift; |
52
|
12
|
100
|
|
|
|
28
|
if (@_) { |
53
|
2
|
50
|
|
|
|
9
|
Carp::croak("Group name can't contain '\@'") if $_[0] =~ /\@/; |
54
|
|
|
|
|
|
|
} |
55
|
12
|
|
|
|
|
31
|
my @old = $self->_group(@_); |
56
|
12
|
100
|
|
|
|
32
|
return if $old[0] =~ /\@/; |
57
|
11
|
100
|
|
|
|
59
|
wantarray ? @old : $old[0]; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub message |
61
|
|
|
|
|
|
|
{ |
62
|
6
|
|
|
6
|
0
|
737
|
my $self = shift; |
63
|
6
|
100
|
|
|
|
27
|
if (@_) { |
64
|
3
|
100
|
|
|
|
204
|
Carp::croak("Message must contain '\@'") unless $_[0] =~ /\@/; |
65
|
|
|
|
|
|
|
} |
66
|
5
|
|
|
|
|
14
|
my $old = $self->_group(@_); |
67
|
5
|
100
|
|
|
|
29
|
return undef unless $old =~ /\@/; |
68
|
2
|
|
|
|
|
8
|
return $old; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |