Dave & Melvyn

Thank you both for the feedback, I knew that PERL had been around long
enough that this should be a simple operation..... just didn't know where to
look. As for that WHITE SPACE I'm learning.


----- Original Message -----
From: "Dave Goode" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 29, 2001 2:56 AM
Subject: RE: [sambar] substitute not working (2)


> What you're missing is that you're reinventing the wheel. Use CGI.pm -
it'll
> handle parsing into name-value pairs, escaping and unescaping flawlessly.
> Look at this example:
>
> ------------------------------------------------
> #! your_path_to_perl
>
>  use strict;
>  use warnings;
>  use CGI;
>
>  my $cgi = new CGI;
>  my $searchfield = $cgi->param('searchfield');
>
>  print $searchfield;
> ------------------------------------------------
>
> and then use it with this URL (change to your server name!) to simulate a
> form submission:
>
> http://foo.com/cgi-bin/test.cgi?searchfield=Lydia%27s
>
> and you'll see Lydia's - exactly what you want with a minimum of code.
> Exactly what you want to see.
>
> Dave
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Jim Kelly
> > Sent: Sunday, October 28, 2001 9:26 PM
> > To: sambar
> > Subject: [sambar] substitute not working (2)
> >
> >
> > I found this code and it works correctly.......$value =~ s
> > /%(..)/pack ("C",
> > hex ($1))/eg;
> >
> > That means something is wrong inside my [   ] and [   ] any ideas?
> >
> >
> > ******************************************************
> > I'm entering this code as written in a book, but can't get it to work.
The
> > splits work, the translate works but the substitute does not..........
The
> > data returned keeps the special characters IE %27.  I have experimented
> > using the /d (for decimal) and entering 0-9 for matches but neither
works.
> > WHAT AM I MISSING?
> >
> > returned data =
> > Lydia%27s burritos are the greatest%21 The guys at work loved them and
it
> > was a real treat when she would prepare them for a team
> > lunch.%0D%0A%0D%0A%0D%0A%0D%0AJim
> >
> >
> > sub readPostInput(){
> >   my (%searchField, $buffer, $pair, @pairs);
> >     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 /%([\dA-Fa-f] [\dA-Fa-f])/pack ("C", hex ($1))/eg;
> >          $name =~ tr/+/ /;
> >          $name =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg;
> >          $searchField{ $name} = $value;
> >       }
> >     }
> >   return (%searchField);
> > }
> >
> >
> > ------------------------------------------------------------------
> > --------------
> > For unsubscription of this list send an email to
> > [EMAIL PROTECTED] with email
> > data containing unsubscribe emailadd sambar
> >
>
>
>
> --------------------------------------------------------------------------
------
> For unsubscription of this list send an email to [EMAIL PROTECTED] with
email
> data containing unsubscribe emailadd sambar

--------------------------------------------------------------------------------
For unsubscription of this list send an email to [EMAIL PROTECTED] with email
data containing unsubscribe emailadd sambar

Reply via email to