Forum Moderators: coopster & phranque

Message Too Old, No Replies

Getting params without using CGI

         

csdude55

7:24 pm on Jul 4, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I know that the CGI module has fallen out of favor in recent years. I don't remember the why, just that it has.

What's your preferred way to get params without using CGI?

I've been converting param() to %contents since Hector was a pup, and I think that's all that I use CGI for. So I'm open to faster / more secure methods to build the %contents hash :-)


My "old" method:

use CGI qw(:standard);

%contents = map { $_ => get_data($_) } param;

sub get_data {
my $name = shift;
my @values = param($name);
return @values > 1 ? \@values : $values[0];
}