in reply to Re: CGI OO 'param' vs. hash
in thread CGI OO 'param' vs. hash
Another good reason to subclass CGI.pm would be to get rid of that Vars() method and replace it with one that uses data structures properly.
sub Vars { my $self = shift; my %formdata; foreach my $name ( $self->param ) { my @values = $self->param( $name ); $formdata{ $name } = scalar @values == 1 ? $values[0] : \@values ; } return \%formdata; }
Of course, that's quick-n-dirty and I haven't tested it. It has the nice effect of getting rid of all of those nasty ASCII zeroes in the original Vars function, thus stopping a nasty potential security hole.
Cheers,
Ovid
Vote for paco!
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re(2): CGI OO 'param' vs. hash
by legLess (Hermit) on Jul 10, 2001 at 00:06 UTC | |
by Ovid (Cardinal) on Jul 10, 2001 at 00:20 UTC | |
by legLess (Hermit) on Jul 10, 2001 at 00:34 UTC | |
by tye (Sage) on Jul 10, 2001 at 01:34 UTC |