[ale] More on name=value

Themack themack at linuxfreak.com
Sat Jul 17 12:05:05 EDT 1999


If you use GET, I would use this:

##################################################
@pairs = split(/&/, $ENV{'QUERY_STRING'});  
foreach $pair (@pairs)   
{  
      ($name, $value) = split(/=/, $pair);  
      $value =~ tr/+/ /;  
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;  
      $value =~ s/<!--(.|\n)*-->//g;  
      $value =~ s/<([^>]|\n)*>//g;  
      $FORM{$name} = $value;  
} 
###################################################
#http://www.mysite/cgi-bin/test.pl?value=15
print "$FORM{'value'}\n": 	#Would print 15

On Sun, 18 Jul 1999, you wrote:
> Bert,
> 
> if you are going to use Perl, you might as well try the CGI module or
> CGI_Lite available from CPAN instead of some dinky little perl thing
> you got from a disreputable source on a mailing list.  I used
> CGI_Lite.  The nice thing about it is that it helps you pass values
> either using the query method, or POST and you don't really need to
> know the difference.
> 
> -Eric.






More information about the Ale mailing list