line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::ConvertParam; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.00; |
4
|
1
|
|
|
1
|
|
539
|
use vars qw($VERSION $AUTOLOAD); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
437
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.05'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new |
10
|
|
|
|
|
|
|
{ |
11
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
12
|
0
|
|
|
|
|
|
my $cgi = shift; |
13
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
14
|
0
|
|
|
|
|
|
$self->query($cgi); |
15
|
0
|
|
|
|
|
|
$self->initialize; |
16
|
0
|
|
|
|
|
|
$self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub AUTOLOAD |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
0
|
|
|
my $self = shift; |
23
|
0
|
0
|
|
|
|
|
return if $AUTOLOAD =~ /::DESTROY$/; |
24
|
0
|
|
|
|
|
|
my $method = $AUTOLOAD; |
25
|
0
|
|
|
|
|
|
$method =~ s/.*://; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$self->query->$method(@_); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub convert_all_param |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
34
|
0
|
|
|
|
|
|
my $query = $self->query; |
35
|
0
|
|
|
|
|
|
foreach my $name ($query->param) { |
36
|
0
|
|
|
|
|
|
$query->param( |
37
|
|
|
|
|
|
|
$name, |
38
|
0
|
|
|
|
|
|
map {$self->do_convert_all_param($_)} $query->param($name) |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
$self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub param |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
48
|
0
|
|
|
|
|
|
my @args = map { $self->do_convert_on_set($_) } @_; |
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my @value = map { $self->do_convert_on_get($_) } |
|
0
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$self->query->param(@args); |
51
|
0
|
0
|
|
|
|
|
return wantarray ? @value : $value[0]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub query |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
58
|
0
|
0
|
|
|
|
|
if (@_) { $self->{_cgi_convertparam_cgi_instance} = shift } |
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$self->{_cgi_convertparam_cgi_instance}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub initialize |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
67
|
|
|
|
|
|
|
# Please OVERRIDE |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub do_convert_all_param |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
my $parameter_value = shift; |
75
|
|
|
|
|
|
|
# Please OVERRIDE |
76
|
0
|
|
|
|
|
|
return $parameter_value; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub do_convert_on_get |
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
83
|
0
|
|
|
|
|
|
my $parameter_value = shift; |
84
|
|
|
|
|
|
|
# Please OVERRIDE |
85
|
0
|
|
|
|
|
|
return $parameter_value; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub do_convert_on_set |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
92
|
0
|
|
|
|
|
|
my $parameter_value = shift; |
93
|
|
|
|
|
|
|
# Please OVERRIDE |
94
|
0
|
|
|
|
|
|
return $parameter_value; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
99
|
|
|
|
|
|
|
__END__ |