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

[MacPerl] CGI question



Hi folks:

I'm usually a lurker here, but I have run into a bit of a problem here.
It's a bit more general PERL than MacPERL specific, but I think you could
help me out. I'm a bit a newbie, so please bear with me.

Whenever I use a PERL script to do CGI (MacPERL or otherwise), I send it
through this routine..

# Split the name-value pairs
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
   ($name, $value) = split(/=/, $pair);

   # Un-Webify plus signs and %-encoding
   $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;
}

the problem I am running into this time is this.. this time the output of
the form is VERY sensitive to linefeeds from the <TEXTAREA>(^M) and crashes
when it gets one.  I tried to add a filter like the one above to change ^M
to a space, but I didn't hit on the correct syntax to make it work.

hope this wasn't to symplistic.. but, hey.. I am learning.

thanks



--davey
http://s-o-l.net/         "Hello, my name is UNIX: FRIEND OR FOE?"
http://www.davey23.net/   -a bit from Microserfs by Douglas Coupland

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