line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
99942
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
277
|
|
2
|
6
|
|
|
6
|
|
65
|
use warnings FATAL => 'all'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
874
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package HTML::Tested::Test::Request::Upload; |
5
|
6
|
|
|
6
|
|
35
|
use base 'Class::Accessor'; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
2490
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(name filename fh size)); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package HTML::Tested::Test::Request; |
9
|
6
|
|
|
6
|
|
17240
|
use base 'Class::Accessor'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
404
|
|
10
|
6
|
|
|
6
|
|
1852
|
use HTML::Tested::Seal; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
163
|
|
11
|
6
|
|
|
6
|
|
38
|
use Data::Dumper; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
410
|
|
12
|
6
|
|
|
6
|
|
43
|
use File::Basename qw(basename); |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
6371
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(_param _pnotes _uploads _dir_config uri)); |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
0
|
1173
|
sub hostname { return "some.host"; } |
17
|
1
|
|
|
1
|
0
|
5
|
sub server { return shift(); } |
18
|
1
|
|
|
1
|
0
|
7
|
sub port { return 80; } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub server_root_relative { |
21
|
0
|
|
|
0
|
0
|
0
|
return $_[1]; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
0
|
631
|
sub body_status { return 'Success'; } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub param { |
27
|
41
|
|
|
41
|
0
|
5039
|
my ($self, $name, $val) = @_; |
28
|
41
|
100
|
100
|
|
|
193
|
return $self->_param unless (wantarray || $name); |
29
|
39
|
100
|
|
|
|
127
|
$self->_param({}) unless $self->_param; |
30
|
39
|
100
|
|
|
|
646
|
$self->_param->{$name} = $val if @_ == 3; |
31
|
39
|
100
|
|
|
|
285
|
return $self->_param->{$name} if ($name); |
32
|
5
|
50
|
|
|
|
11
|
return keys %{ $self->_param || {} }; |
|
5
|
|
|
|
|
18
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub dir_config { |
36
|
0
|
|
|
0
|
0
|
0
|
my ($self, $name, $val) = @_; |
37
|
0
|
|
|
|
|
0
|
my $dc = $self->_dir_config; |
38
|
0
|
0
|
|
|
|
0
|
if (!$dc) { |
39
|
0
|
|
|
|
|
0
|
$dc = {}; |
40
|
0
|
|
|
|
|
0
|
$self->_dir_config($dc); |
41
|
|
|
|
|
|
|
} |
42
|
0
|
0
|
|
|
|
0
|
return $dc->{$name} if (@_ < 3); |
43
|
0
|
0
|
|
|
|
0
|
$dc->{$name} = $val if defined($val); |
44
|
0
|
0
|
|
|
|
0
|
delete $dc->{$name} if !defined($val); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 $object->set_params($paramref) |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Sets param values according to C<$paramref> hash. Clears old params first. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Parameter names starting with C are encrypted and C |
52
|
|
|
|
|
|
|
prefix is removed. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
sub set_params { |
56
|
3
|
|
|
3
|
1
|
1180
|
my ($self, $p) = @_; |
57
|
3
|
|
|
|
|
16
|
$self->_param({}); |
58
|
3
|
|
|
|
|
73
|
while (my ($n, $v) = each %$p) { |
59
|
4
|
100
|
|
|
|
142
|
$v = HTML::Tested::Seal->instance->encrypt($v) |
60
|
|
|
|
|
|
|
if ($n =~ s/^HT_SEALED_//); |
61
|
4
|
|
|
|
|
252
|
$self->param($n, $v); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub parse_url { |
66
|
2
|
|
|
2
|
0
|
1550
|
my ($self, $url) = @_; |
67
|
2
|
|
|
|
|
9
|
my ($arg_str) = ($url =~ /\?(.+)/); |
68
|
2
|
50
|
|
|
|
7
|
return unless $arg_str; |
69
|
2
|
|
|
|
|
8
|
my @nvs = split('&', $arg_str); |
70
|
6
|
|
|
|
|
14
|
my %res = map { |
71
|
2
|
|
|
|
|
5
|
my @a = split('=', $_); |
72
|
6
|
|
100
|
|
|
29
|
($a[0], ($a[1] || '')); |
73
|
|
|
|
|
|
|
} @nvs; |
74
|
2
|
|
|
|
|
10
|
$self->_param(\%res); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub pnotes { |
78
|
0
|
|
|
0
|
0
|
0
|
my ($self, $name, $val) = @_; |
79
|
0
|
0
|
|
|
|
0
|
$self->_pnotes({}) unless $self->_pnotes; |
80
|
0
|
0
|
|
|
|
0
|
return $self->_pnotes->{$name} unless scalar(@_) > 2; |
81
|
0
|
|
|
|
|
0
|
$self->_pnotes->{$name} = $val; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub add_upload { |
85
|
6
|
|
|
6
|
0
|
2762
|
my ($self, $n, $v) = @_; |
86
|
6
|
100
|
|
|
|
26
|
$self->_uploads([]) unless $self->_uploads; |
87
|
6
|
50
|
|
|
|
514
|
open(my $fh, $v) or die "Unable to open $v"; |
88
|
6
|
|
|
|
|
10
|
push @{ $self->_uploads }, HTML::Tested::Test::Request::Upload->new({ |
|
6
|
|
|
|
|
25
|
|
89
|
|
|
|
|
|
|
name => $n, filename => $v , fh => $fh, size => -s $v }); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub upload { |
93
|
20
|
|
|
20
|
0
|
3202
|
my ($self, $n) = @_; |
94
|
20
|
|
50
|
|
|
71
|
my $ups = $self->_uploads || []; |
95
|
20
|
100
|
|
|
|
211
|
return $n ? (grep { $_->name eq $n } @$ups)[0] : map { $_->name } @$ups; |
|
15
|
|
|
|
|
75
|
|
|
10
|
|
|
|
|
40
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub as_string { |
99
|
1
|
|
|
1
|
0
|
497
|
return Dumper(shift()); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |