line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Headers::ActionPack::LinkHeader; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
8
|
|
|
8
|
|
44658
|
$HTTP::Headers::ActionPack::LinkHeader::AUTHORITY = 'cpan:STEVAN'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$HTTP::Headers::ActionPack::LinkHeader::VERSION = '0.09'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: A Link |
9
|
|
|
|
|
|
|
|
10
|
8
|
|
|
8
|
|
58
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
241
|
|
11
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
361
|
|
12
|
|
|
|
|
|
|
|
13
|
8
|
|
|
8
|
|
4322
|
use URI::Escape qw[ uri_escape uri_unescape ]; |
|
8
|
|
|
|
|
10825
|
|
|
8
|
|
|
|
|
711
|
|
14
|
8
|
|
|
8
|
|
2196
|
use HTTP::Headers::ActionPack::Util qw[ join_header_words ]; |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
68
|
|
15
|
|
|
|
|
|
|
|
16
|
8
|
|
|
8
|
|
4124
|
use parent 'HTTP::Headers::ActionPack::Core::BaseHeaderType'; |
|
8
|
|
|
|
|
954
|
|
|
8
|
|
|
|
|
124
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BUILDARGS { |
19
|
28
|
|
|
28
|
1
|
45
|
my $class = shift; |
20
|
28
|
|
|
|
|
120
|
my ($href, @params) = @_; |
21
|
|
|
|
|
|
|
|
22
|
28
|
|
|
|
|
145
|
$href =~ s/^/; |
23
|
28
|
|
|
|
|
95
|
$href =~ s/>$//; |
24
|
|
|
|
|
|
|
|
25
|
28
|
|
|
|
|
165
|
$class->SUPER::BUILDARGS( $href, @params ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub BUILD { |
29
|
28
|
|
|
28
|
1
|
45
|
my $self = shift; |
30
|
28
|
|
|
|
|
50
|
foreach my $param ( grep { /\*$/ } @{ $self->_param_order } ) { |
|
40
|
|
|
|
|
193
|
|
|
28
|
|
|
|
|
282
|
|
31
|
2
|
|
|
|
|
9
|
my ($encoding, $language, $content) = ( $self->params->{ $param } =~ /^(.*)\'(.*)\'(.*)$/); |
32
|
2
|
|
|
|
|
12
|
$self->params->{ $param } = { |
33
|
|
|
|
|
|
|
encoding => $encoding, |
34
|
|
|
|
|
|
|
language => $language, |
35
|
|
|
|
|
|
|
content => uri_unescape( $content ) |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
43
|
|
|
43
|
1
|
2259
|
sub href { (shift)->subject } |
41
|
6
|
|
|
6
|
0
|
33
|
sub rel { (shift)->params->{'rel'} } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub relation_matches { |
44
|
11
|
|
|
11
|
0
|
21
|
my ($self, $relation) = @_; |
45
|
|
|
|
|
|
|
|
46
|
11
|
50
|
|
|
|
40
|
if ( my $rel = $self->params->{'rel'} ) { |
47
|
|
|
|
|
|
|
# if it is an extension rel type |
48
|
|
|
|
|
|
|
# then it is a URI and it should |
49
|
|
|
|
|
|
|
# not be compared in a case-insensitive |
50
|
|
|
|
|
|
|
# manner ... |
51
|
11
|
100
|
|
|
|
37
|
if ( $rel =~ m!^\w+\://! ) { |
52
|
2
|
100
|
|
|
|
9
|
$self->params->{'rel'} eq $relation ? 1 : 0; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
# if it is not a URI, then compare |
55
|
|
|
|
|
|
|
# it case-insensitively |
56
|
|
|
|
|
|
|
else { |
57
|
9
|
50
|
|
|
|
25
|
(lc $self->params->{'rel'} ) eq (lc $relation) ? 1 : 0; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub as_string { |
63
|
37
|
|
|
37
|
1
|
61
|
my $self = shift; |
64
|
|
|
|
|
|
|
|
65
|
37
|
|
|
|
|
46
|
my @params; |
66
|
37
|
|
|
|
|
43
|
foreach my $param ( @{ $self->_param_order } ) { |
|
37
|
|
|
|
|
129
|
|
67
|
55
|
100
|
|
|
|
223
|
if ( $param =~ /\*$/ ) { |
68
|
2
|
|
|
|
|
6
|
my $complex = $self->params->{ $param }; |
69
|
2
|
|
|
|
|
10
|
push @params => ( $param, |
70
|
|
|
|
|
|
|
join "'" => ( |
71
|
|
|
|
|
|
|
$complex->{'encoding'}, |
72
|
|
|
|
|
|
|
$complex->{'language'}, |
73
|
|
|
|
|
|
|
uri_escape( $complex->{'content'} ), |
74
|
|
|
|
|
|
|
) |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
else { |
78
|
53
|
|
|
|
|
204
|
push @params => ( $param, $self->params->{ $param } ); |
79
|
|
|
|
|
|
|
} |
80
|
55
|
|
|
|
|
260
|
my ($encoding, $language, $content) = ( $self->params->{ $param } =~ /^(.*)\'(.*)\'(.*)$/); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
37
|
|
|
|
|
105
|
join_header_words( '<' . $self->href . '>', @params ); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |