line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::FormBuilderX::More::InputTie; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
118
|
|
4
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
109
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
2785
|
use Carp::Clan qw/^CGI::FormBuilderX::More::/; |
|
3
|
|
|
|
|
8452
|
|
|
3
|
|
|
|
|
22
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use CGI::FormBuilderX::More; |
11
|
|
|
|
|
|
|
use CGI::FormBuilderX::More::InputTie; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $form = CGI::FormBuilderX::More->new( ... ); |
14
|
|
|
|
|
|
|
my %hash; |
15
|
|
|
|
|
|
|
tie %hash, $form; # %hash is now tied to the input of $form |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
if (exists $hash{username}) { |
18
|
|
|
|
|
|
|
... |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$hash{password} = "12345" |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 TIEHASH($form) |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my %hash; |
28
|
|
|
|
|
|
|
tie %hash, $form; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# %hash is now tied to $form input |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub TIEHASH { |
35
|
3
|
|
|
3
|
|
14
|
my $self = bless {}, shift; |
36
|
3
|
|
|
|
|
6
|
my $form = shift; |
37
|
3
|
|
|
|
|
14
|
$self->{form} = $form; |
38
|
3
|
|
|
|
|
15
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 STORE($key, $value) |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$hash{$key} = $value |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub { |
46
|
|
|
|
|
|
|
return $form->input_store($key, $value) |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub STORE { |
52
|
1
|
|
|
1
|
|
504
|
my $self = shift; |
53
|
1
|
|
|
|
|
3
|
my ($key, $value) = @_; |
54
|
1
|
|
|
|
|
8
|
return $self->{form}->input_store($key => $value); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 FETCH($key) |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$value = $hash{$key}; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub { |
62
|
|
|
|
|
|
|
return $form->input_fetch($key) |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub FETCH { |
68
|
2
|
|
|
2
|
|
1078
|
my $self = shift; |
69
|
2
|
|
|
|
|
5
|
my ($key) = @_; |
70
|
2
|
|
|
|
|
13
|
return $self->{form}->input_fetch($key); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 EXISTS($key) |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
exists $hash{$key}; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub { |
78
|
|
|
|
|
|
|
return ! $form->missing($key) |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub EXISTS { |
84
|
7
|
|
|
7
|
|
1121
|
my $self = shift; |
85
|
7
|
|
|
|
|
14
|
my ($key) = @_; |
86
|
7
|
|
|
|
|
42
|
return ! $self->{form}->missing($key); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 SCALAR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub { |
92
|
|
|
|
|
|
|
return scalar $form->{params}->param |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub SCALAR { |
98
|
0
|
|
|
0
|
|
|
my $self = shift; |
99
|
0
|
|
|
|
|
|
return scalar $self->{form}->{params}->param; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 FIRSTKEY |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
N/A |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub FIRSTKEY { |
109
|
0
|
|
|
0
|
|
|
croak __PACKAGE__ . "::FIRSTKEY is invalid" |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 NEXTKEY |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
N/A |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub NEXTKEY { |
119
|
0
|
|
|
0
|
|
|
croak __PACKAGE__ . "::NEXTKEY is invalid" |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 DELETE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
N/A |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub DELETE { |
129
|
0
|
|
|
0
|
|
|
croak __PACKAGE__ . "::DELETE is invalid" |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 CLEAR |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
N/A |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub CLEAR { |
139
|
0
|
|
|
0
|
|
|
croak __PACKAGE__ . "::CLEAR is invalid" |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |