[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [MacPerl] Thanks 4 HELP, it Works But.....




Simone wrote:
>In example in order to get forms variable I usally use this lines:
>
>if ($ENV{'REQUEST_METHOD'} eq 'POST')
>{
>	read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>	@pairs = split(/&/, $buffer);
>	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 =~ tr/,/ /;
>		$contents{$name} = $value;
>	}
>}
>
>
>Is this valid for MacPerl ? I suppose no. :(

I use a slight variation:

$buffer =~ tr/+/ /;
$buffer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$buffer =~ s/<!--(.|\n)*-->//g;
$buffer =~ s/<([^>]|\n)*>//g;

do this before the split statement.

>and what about path variables like
>$filepath = "/www/web/user/folder/file.txt";

The mac pathname delimiter is ":", not "/".  The easiest thing to do is
set an environment variable
and build pathnames based on its settings.




***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch