line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::NoPoison; |
2
|
1
|
|
|
1
|
|
51132
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
6
|
use Carp 'croak'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
317
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '3.11'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#note that we are overriding AUTOLOADed methods in CGI.pm in this way |
8
|
|
|
|
|
|
|
#so we aren't having to use the "no warnings 'redefine'" pragma ;) |
9
|
|
|
|
|
|
|
sub CGI::FETCH { |
10
|
3
|
50
|
|
3
|
|
8388
|
return $_[0] if $_[1] eq 'CGI'; |
11
|
3
|
50
|
|
|
|
15
|
return undef unless defined $_[0]->param($_[1]); |
12
|
|
|
|
|
|
|
#Instead of returning a null-byte packed list, introducing |
13
|
|
|
|
|
|
|
#potential security problems, why not instead return an |
14
|
|
|
|
|
|
|
#anonymous array and just dereference it later ? |
15
|
|
|
|
|
|
|
#return join("\0",$_[0]->param($_[1])); |
16
|
3
|
|
|
|
|
69
|
my @a = $_[0]->param($_[1]); |
17
|
3
|
100
|
|
|
|
59
|
if ( scalar( @a ) > 1 ) |
18
|
|
|
|
|
|
|
{ |
19
|
2
|
|
|
|
|
8
|
return [$_[0]->param($_[1])]; # return anon-array if more than one element |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else |
22
|
|
|
|
|
|
|
{ |
23
|
1
|
|
|
|
|
5
|
return $_[0]->param($_[1]); # behave normally otherwise, so we have a true drop-in replacement |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#and if we're going to do THAT, well, we might as well |
28
|
|
|
|
|
|
|
sub CGI::SplitParam { |
29
|
0
|
|
|
0
|
0
|
|
my ($param) = @_; |
30
|
|
|
|
|
|
|
#my (@params) = split ("\0", $param); |
31
|
|
|
|
|
|
|
#my (@params) = @{$param}; # wait, why bother with this? |
32
|
|
|
|
|
|
|
#return (wantarray ? @params : $params[0]); |
33
|
0
|
0
|
|
|
|
|
return (wantarray ? @{$param} : @{$param}[0]);# when you can just do this, instead! :) |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#and also should probably |
37
|
|
|
|
|
|
|
sub CGI::STORE { |
38
|
0
|
|
|
0
|
|
|
my $self = shift; |
39
|
0
|
|
|
|
|
|
my $tag = shift; |
40
|
|
|
|
|
|
|
# this should now be a reference to a named or an anonymous array |
41
|
|
|
|
|
|
|
# ala $vals = [ qw(list goes here) ]; or $vals = \@ary; |
42
|
0
|
|
|
|
|
|
my $vals = shift; |
43
|
|
|
|
|
|
|
#my @vals = index($vals,"\0")!=-1 ? split("\0",$vals) : $vals; |
44
|
0
|
0
|
|
|
|
|
croak "Value list not an array reference" |
45
|
|
|
|
|
|
|
unless ref($vals) eq 'ARRAY'; |
46
|
|
|
|
|
|
|
#$self->param(-name=>$tag,-value=>\@vals); |
47
|
0
|
|
|
|
|
|
$self->param(-name=>$tag,-value=>$vals);# look ma, it's *already* a reference! |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |