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

Re: [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
>

Hello,

     You could "use" Lincoln Stein's CGI.pm, since this module provides the
functionatity to do what you did above, as well as much more. "Use"ing modules
permits a greater level of abstraction, and insulates you from much of the
lower level interfaces.

Bob

__________________________________________________________________
Bob Wilkinson (Perl Programmer, Database Engineer, Systems Admin.)
Pindar plc, 60 Piccadilly, York, YO1 1NX, England, UK
Tel: +44 (0)1904 617547    Email: B.Wilkinson@pindar.com
Fax: +44 (0)1904 613110    URL: http://www.connection.co.uk/bob
__________________________________________________________________
   I don't speak for my employer - er, they made me say that..



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