line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
404
|
|
|
404
|
|
3030
|
use strict; |
|
404
|
|
|
|
|
944
|
|
|
404
|
|
|
|
|
21979
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::FakeQuery; |
4
|
|
|
|
|
|
|
# ABSTRACT: fake query |
5
|
|
|
|
|
|
|
$HTML::FormFu::FakeQuery::VERSION = '2.07'; |
6
|
404
|
|
|
404
|
|
2484
|
use warnings; |
|
404
|
|
|
|
|
843
|
|
|
404
|
|
|
|
|
14571
|
|
7
|
|
|
|
|
|
|
|
8
|
404
|
|
|
404
|
|
2437
|
use Scalar::Util qw( reftype ); |
|
404
|
|
|
|
|
841
|
|
|
404
|
|
|
|
|
24292
|
|
9
|
404
|
|
|
404
|
|
2443
|
use Carp qw( croak ); |
|
404
|
|
|
|
|
880
|
|
|
404
|
|
|
|
|
190439
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
404
|
|
|
404
|
0
|
1521
|
my ( $class, $form, $param ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
404
|
50
|
|
|
|
2619
|
croak 'argument must be a hashref' |
15
|
|
|
|
|
|
|
if reftype($param) ne 'HASH'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# handle pre-expanded input |
18
|
|
|
|
|
|
|
|
19
|
1144
|
|
|
|
|
3220
|
my @names = grep {defined} |
20
|
404
|
|
|
|
|
1117
|
map { $_->nested_name } @{ $form->get_fields }; |
|
1148
|
|
|
|
|
4359
|
|
|
404
|
|
|
|
|
1979
|
|
21
|
|
|
|
|
|
|
|
22
|
404
|
|
|
|
|
1659
|
for my $name (@names) { |
23
|
1144
|
100
|
|
|
|
3365
|
next if exists $param->{$name}; |
24
|
|
|
|
|
|
|
|
25
|
222
|
100
|
|
|
|
1067
|
if ( $form->nested_hash_key_exists( $param, $name ) ) { |
26
|
3
|
|
|
|
|
11
|
$param->{$name} = $form->get_nested_hash_value( $param, $name ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
404
|
|
|
|
|
2089
|
my $self = { _params => $param }; |
31
|
|
|
|
|
|
|
|
32
|
404
|
|
|
|
|
1930
|
return bless $self, $class; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
0
|
0
|
sub multi_param { goto ¶m } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub param { |
38
|
2961
|
|
|
2961
|
0
|
5323
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
2961
|
100
|
|
|
|
9817
|
if ( !@_ ) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
41
|
806
|
|
|
|
|
1460
|
return keys %{ $self->{_params} }; |
|
806
|
|
|
|
|
4853
|
|
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
|
2155
|
|
|
|
|
4609
|
my ($param) = @_; |
51
|
|
|
|
|
|
|
|
52
|
2155
|
100
|
|
|
|
5543
|
if ( !exists $self->{_params}{$param} ) { |
53
|
169
|
50
|
|
|
|
1261
|
return wantarray ? () : undef; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
1986
|
100
|
|
|
|
5271
|
if ( ref $self->{_params}{$param} eq 'ARRAY' ) { |
57
|
|
|
|
|
|
|
return (wantarray) |
58
|
86
|
|
|
|
|
365
|
? @{ $self->{_params}{$param} } |
59
|
146
|
100
|
|
|
|
727
|
: $self->{_params}{$param}->[0]; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
|
|
|
|
|
|
return (wantarray) |
63
|
|
|
|
|
|
|
? ( $self->{_params}{$param} ) |
64
|
1840
|
100
|
|
|
|
8503
|
: $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; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=pod |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=encoding UTF-8 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
HTML::FormFu::FakeQuery - fake query |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 VERSION |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
version 2.07 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
103
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |