line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormFu::FakeQuery; |
2
|
|
|
|
|
|
|
|
3
|
400
|
|
|
400
|
|
1599
|
use strict; |
|
400
|
|
|
|
|
593
|
|
|
400
|
|
|
|
|
11101
|
|
4
|
400
|
|
|
400
|
|
1401
|
use warnings; |
|
400
|
|
|
|
|
502
|
|
|
400
|
|
|
|
|
16566
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
400
|
|
|
400
|
|
1495
|
use Scalar::Util qw( reftype ); |
|
400
|
|
|
|
|
503
|
|
|
400
|
|
|
|
|
21143
|
|
9
|
400
|
|
|
400
|
|
1528
|
use Carp qw( croak ); |
|
400
|
|
|
|
|
533
|
|
|
400
|
|
|
|
|
134433
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
403
|
|
|
403
|
0
|
998
|
my ( $class, $form, $param ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
403
|
50
|
|
|
|
2043
|
croak 'argument must be a hashref' |
15
|
|
|
|
|
|
|
if reftype($param) ne 'HASH'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# handle pre-expanded input |
18
|
|
|
|
|
|
|
|
19
|
1164
|
|
|
|
|
2164
|
my @names = grep {defined} |
20
|
403
|
|
|
|
|
609
|
map { $_->nested_name } @{ $form->get_fields }; |
|
1168
|
|
|
|
|
2948
|
|
|
403
|
|
|
|
|
2219
|
|
21
|
|
|
|
|
|
|
|
22
|
403
|
|
|
|
|
1027
|
for my $name (@names) { |
23
|
1164
|
100
|
|
|
|
2357
|
next if exists $param->{$name}; |
24
|
|
|
|
|
|
|
|
25
|
246
|
100
|
|
|
|
835
|
if ( $form->nested_hash_key_exists( $param, $name ) ) { |
26
|
3
|
|
|
|
|
8
|
$param->{$name} = $form->get_nested_hash_value( $param, $name ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
403
|
|
|
|
|
1111
|
my $self = { _params => $param }; |
31
|
|
|
|
|
|
|
|
32
|
403
|
|
|
|
|
1369
|
return bless $self, $class; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
0
|
0
|
sub multi_param { goto ¶m } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub param { |
38
|
2970
|
|
|
2970
|
0
|
2914
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
2970
|
100
|
|
|
|
7506
|
if ( !@_ ) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
41
|
804
|
|
|
|
|
785
|
return keys %{ $self->{_params} }; |
|
804
|
|
|
|
|
3600
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
elsif ( @_ == 2 ) { |
44
|
0
|
|
|
|
|
0
|
my ( $param, $value ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
$self->{$param} = $value; |
47
|
0
|
|
|
|
|
0
|
return $self->{_params}{$param}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
elsif ( @_ == 1 ) { |
50
|
2166
|
|
|
|
|
2148
|
my ($param) = @_; |
51
|
|
|
|
|
|
|
|
52
|
2166
|
100
|
|
|
|
3821
|
if ( !exists $self->{_params}{$param} ) { |
53
|
193
|
50
|
|
|
|
887
|
return wantarray ? () : undef; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
1973
|
100
|
|
|
|
3345
|
if ( ref $self->{_params}{$param} eq 'ARRAY' ) { |
57
|
|
|
|
|
|
|
return (wantarray) |
58
|
86
|
|
|
|
|
299
|
? @{ $self->{_params}{$param} } |
59
|
146
|
100
|
|
|
|
437
|
: $self->{_params}{$param}->[0]; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
|
|
|
|
|
|
return (wantarray) |
63
|
|
|
|
|
|
|
? ( $self->{_params}{$param} ) |
64
|
1827
|
100
|
|
|
|
6296
|
: $self->{_params}{$param}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
croak 'require arguments [$name, [$value]]'; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# dummy methods, so FakeQuery doesn't cause fatal errors |
72
|
|
|
|
|
|
|
# if a form is submitted |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
0
|
0
|
|
sub upload { } |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
0
|
0
|
|
sub uploadInfo { {} } |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |