line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Headers::ActionPack::Core::BaseHeaderWithParams; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
17
|
|
|
17
|
|
16708
|
$HTTP::Headers::ActionPack::Core::BaseHeaderWithParams::AUTHORITY = 'cpan:STEVAN'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$HTTP::Headers::ActionPack::Core::BaseHeaderWithParams::VERSION = '0.09'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: A Base header type with parameters |
9
|
|
|
|
|
|
|
|
10
|
17
|
|
|
17
|
|
143
|
use strict; |
|
17
|
|
|
|
|
38
|
|
|
17
|
|
|
|
|
617
|
|
11
|
17
|
|
|
17
|
|
89
|
use warnings; |
|
17
|
|
|
|
|
37
|
|
|
17
|
|
|
|
|
658
|
|
12
|
|
|
|
|
|
|
|
13
|
17
|
|
|
17
|
|
93
|
use Carp qw[ confess ]; |
|
17
|
|
|
|
|
182
|
|
|
17
|
|
|
|
|
1184
|
|
14
|
|
|
|
|
|
|
|
15
|
17
|
|
|
17
|
|
112
|
use parent 'HTTP::Headers::ActionPack::Core::Base'; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
233
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# NOTE: |
18
|
|
|
|
|
|
|
# this is meant to be |
19
|
|
|
|
|
|
|
# called by subclasses |
20
|
|
|
|
|
|
|
# in their BUILDARGS |
21
|
|
|
|
|
|
|
# methods |
22
|
|
|
|
|
|
|
# - SL |
23
|
|
|
|
|
|
|
sub _prepare_params { |
24
|
206
|
|
|
206
|
|
473
|
my ($class, @params) = @_; |
25
|
|
|
|
|
|
|
|
26
|
206
|
50
|
|
|
|
595
|
confess "Params must be an even sized list" unless (((scalar @params) % 2) == 0); |
27
|
|
|
|
|
|
|
|
28
|
206
|
|
|
|
|
406
|
my @param_order; |
29
|
206
|
|
|
|
|
646
|
for ( my $i = 0; $i < $#params; $i += 2 ) { |
30
|
222
|
|
|
|
|
717
|
push @param_order => $params[ $i ]; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return +{ |
34
|
206
|
|
|
|
|
2612
|
params => { @params }, |
35
|
|
|
|
|
|
|
param_order => \@param_order |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
629
|
|
|
629
|
1
|
3729
|
sub params { (shift)->{'params'} } |
40
|
418
|
|
|
418
|
|
4445
|
sub _param_order { (shift)->{'param_order'} } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub add_param { |
43
|
0
|
|
|
0
|
1
|
0
|
my ($self, $k, $v) = @_; |
44
|
0
|
|
|
|
|
0
|
$self->params->{ $k } = $v; |
45
|
0
|
|
|
|
|
0
|
push @{ $self->_param_order } => $k; |
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub remove_param { |
49
|
0
|
|
|
0
|
1
|
0
|
my ($self, $k) = @_; |
50
|
0
|
|
|
|
|
0
|
$self->{'param_order'} = [ grep { $_ ne $k } @{ $self->{'param_order'} } ]; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
51
|
0
|
|
|
|
|
0
|
return delete $self->params->{ $k }; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub params_in_order { |
55
|
353
|
|
|
353
|
0
|
442
|
my $self = shift; |
56
|
353
|
|
|
|
|
383
|
map { $_, $self->params->{ $_ } } @{ $self->_param_order } |
|
245
|
|
|
|
|
593
|
|
|
353
|
|
|
|
|
968
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub params_are_empty { |
60
|
35
|
|
|
35
|
1
|
51
|
my $self = shift; |
61
|
35
|
100
|
|
|
|
45
|
(scalar keys %{ $self->params }) == 0 ? 1 : 0 |
|
35
|
|
|
|
|
82
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |