line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URL::Signature::Path; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
21487
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
88
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
5
|
2
|
|
|
2
|
|
1684
|
use parent 'URL::Signature'; |
|
2
|
|
|
|
|
734
|
|
|
2
|
|
|
|
|
11
|
|
6
|
2
|
|
|
2
|
|
109
|
use Params::Util qw( _NONNEGINT ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
613
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
1
|
|
|
1
|
1
|
16
|
my ($class, %attrs) = @_; |
13
|
1
|
|
|
|
|
15
|
return $class->SUPER::new( %attrs, format => 'path' ); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub BUILD { |
17
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
18
|
2
|
50
|
|
|
|
42
|
$self->{'as'} = 1 unless exists $self->{'as'}; |
19
|
2
|
50
|
|
|
|
69
|
Carp::croak( q[in 'path' format, 'as' needs to be a non-negative integer]) |
20
|
|
|
|
|
|
|
unless defined _NONNEGINT($self->{'as'}); |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
28
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub extract { |
27
|
3
|
|
|
3
|
1
|
7
|
my ($self, $uri) = @_; |
28
|
3
|
|
|
|
|
8
|
my @segments = $uri->path_segments; |
29
|
3
|
50
|
|
|
|
138
|
return if scalar @segments <= $self->{'as'}; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
8
|
my $code = splice @segments, $self->{'as'}, 1; |
32
|
3
|
|
|
|
|
10
|
$uri->path_segments( @segments ); |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
146
|
return ($code, $uri); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub append { |
39
|
3
|
|
|
3
|
1
|
8
|
my ($self, $uri, $code) = @_; |
40
|
3
|
|
|
|
|
11
|
my @segments = $uri->path_segments; |
41
|
3
|
50
|
|
|
|
130
|
return if scalar @segments <= $self->{'as'}; |
42
|
3
|
|
|
|
|
11
|
splice @segments, $self->{'as'}, 0, $code; |
43
|
3
|
|
|
|
|
12
|
$uri->path_segments(@segments); |
44
|
3
|
|
|
|
|
206
|
return $uri; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
42; |
49
|
|
|
|
|
|
|
__END__ |