This gives you access to all form input and URL params like this:sub parse_input { # Get the form input.. read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # get the commandline URL input.. $buffer .= '&'.$ENV{'QUERY_STRING'}; $buffer =~ s/%26/*amp*/g; $buffer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $buffer =~ tr/\+/ /; @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair,2); $value =~ tr/==/=/; # convert back to $value =~ s/\*amp\*/&/g; $value =~ s/\*plus\*/\+/g; if($name ne '') { if($params{$name} eq '') { $params{$name} = $value; # build hash array } else { if($name ne 'pid') { $params{$name} .= $params_delim.$value; } } $this_field_name = '$'.$name; $this_param_value = $params{$name}; eval($this_field_name.' = &tokenise("'.$this_param_value.'")'); } } return $buffer; }
All comments on improving this are welcome however Im sure most Monks will say use CGI :-)http://www.wolispace.com/cgi-bin/a.pl?username=wolis print $params{'username'}; print $username;
___ /\__\ "What is the world coming to?" \/__/ www.wolispace.com
In reply to Re: the search string and me
by wolis
in thread the search string and me
by deveyus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |