All,
Which is faster, using the CGI.pm param function to get form input, or parsing out the
hash within my script? I've got a script that currently uses a lot of system
resources, and I'm looking for ways to optimize it.
I have the following subroutine in my script:
sub getform { $buffer = ""; read(STDIN, $buffer,
$ENV{'CONTENT_LENGTH'}); @pairs=split(/&/,$buffer); foreach $pair
(@pairs) { @a = split(/=/,$pair); $name=$a[0];
$value=$a[1]; $value =~ s/\+/ /g; $value =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/~!/
~!/g; $value =~ s/[\r\n]//g; push (@data,$name);
push (@data,$value); } %form=@data; %form;}
Is it faster to run this, or use CGI.pm and call param()?
-GPG
Visit Zanpo, Virtual City
http://www.zanpo.com