Hi Johan,

Let's tell you a secret.
I don't know what it means as well :)
Well some part then. This is just typicaly something I always re-use and
actualy never had the time to re-look at it.

Don't worry about the length by the way. Just give it a try, it never failed for
me. And maybe you might become one of the zombies (just like me), that now and
than just steals code and re-uses it without understanding what it does :)

Now let's at least give some info :

my $head = $ENV{QUERY_STRING};  ## Just read 1 of the Enironment vars and put it 
                                   into $head. In this case you request the query 
string.
                                   You might want to use google.com, look at :
                                   http://hoohoo.ncsa.uiuc.edu/cgi/env.html
                                   
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

Well This is where we have this mailinglist for. Regex is not my best part.
But as we all have to learn :)


my ${$name} = $value;

Just a way of craeting a scalar. We just found out for example : $name = "serie";
                                                                 $value = 10;

So what we do is : ${serie} = 10;
or $serie= 10;


Hhhm, relooking at the length($buffer). Could be taken out from what I can see.
Don't know what it does out there.


Regs David
----------------------------------

> 
> Puh thats tought! So i have to go the hard way for it? What a pity!
> Lets see if i understand the code... Is there any source where I can read about 
>passing parameters to a perl script via the browser?
> 
> > One solution, when not using $value = param('value');
> > 
> > sub parse_form {
> > 
> >   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> > 
>       [Theuerkorn Johannes]  so i have to give the length of the variable name and 
>value? And what if i donīt know it before?
> >     if (length($buffer) < 5) {
> >           $head = $ENV{QUERY_STRING};
> >      }
>       [Theuerkorn Johannes]  No, i donīt understand the reading part at all ... :-(
> 
> >    @pairs = split(/\?/, $head); # split vars using ? as delimitor
> >     foreach $pair(@pairs) {
> >        ($name, $value) = split(/=/, $pair); # split var and value using = as delim.
> > 
>       [Theuerkorn Johannes]  Ok, so i got the name and values somehow into the pairs 
>array and now i put it into two variables $name and $value for further use, right? 
>But again i donīt know how the values got into $head...
> 
> >        $value =~ tr/+/ /;
> >        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> > 
> > 
>       [Theuerkorn Johannes]  Ok, have to learn a lot as it seems, i definetely have 
>no clue what happens here,... OK, lets try: in the first line you change every + to a 
>blank, donīt you? And as far as I know from RegExp, in the second line you change 
>EVERYTHING to something. But to what?
> >     
> >    ${$name} = $value;
> >     
>       [Theuerkorn Johannes]  Hey thats cool, i definetely understand that! ;-)
> > }
> >  } # End sub parse_form
> >  
> >  
> >  
> >  Regs David
> >  ---------------------
> >  > From [EMAIL PROTECTED] Tue Jun 25 
>15:32:57 MET 2002
> > > Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> > > Precedence: bulk
> > > List-Post: <mailto:[EMAIL PROTECTED]>
> > > List-Help: <mailto:[EMAIL PROTECTED]>
> > > List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
> > > List-Subscribe: <mailto:[EMAIL PROTECTED]>
> > > Delivered-To: mailing list [EMAIL PROTECTED]
> > > Message-ID: <AEEEEE93AFA5D411AF8500D0B75E4A16058EE1B5@BSL203E>
> > > To: "'MECKLIN, JOE (ASI)'" <[EMAIL PROTECTED]>
> > > Cc: [EMAIL PROTECTED]
> > > Subject: AW: param problem
> > > Date: Tue, 25 Jun 2002 15:10:05 +0200
> > > MIME-Version: 1.0
> > > X-Mailer: Internet Mail Service (5.5.2653.19)
> > > Content-Type: text/plain;
> >     charset="ISO-8859-1"
> > > Content-Transfer-Encoding: quoted-printable
> > > Content-Length: 1671
> > > Status: RO
> > > 
> > > Thanks, but this doesnīt work either, the problem with the &#43 is that the 
>cgi:param method takes everything after the & sign as the next variable. As the 
>syntax for the param method is: 
>http://server/script.pl?variable1=value&variable2=value...etc
> > > 
> > > > -----Ursprüngliche Nachricht-----
> > > > Von:    MECKLIN, JOE (ASI) [SMTP:[EMAIL PROTECTED]]
> > > > Gesendet am:    Dienstag, 25. Juni 2002 15:05
> > > > An:     'Theuerkorn Johannes'
> > > > Betreff:        RE: param problem
> > > > 
> > > > In place of the plus sign (+), try sending the html encoding &#43
> > > > The html on the receiving end should translate that to a plus sign.
> > > > 
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Theuerkorn Johannes [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, June 25, 2002 7:59 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: cgi:param problem
> > > > 
> > > > 
> > > > Hi there, 
> > > > 
> > > > iīve got to pass a serial number to a perl.cgi. Doing it via the cgi:param
> > > > funktion seems not to work.
> > > > 
> > > > 
> > > > >use strict;
> > > > >use CGI;
> > > > >use DBI;
> > > > >my $cgi_obj = new CGI;
> > > > >my $seriennummer = $cgi_obj->param("seriennummer");
> > > > 
> > > > Passing http://server/script4.pl?seriennummer=CN+/P4226666
> > > > 
> > > > results in a variable seriennummer=CN/P4226666
> > > > 
> > > > As i want to use the variable seriennummer for an SQL Query later, this> 
> > > > doesnīt work.
> > > > 
> > > > Any possibility passing the + to my cgi Script? (\+ doesnīt work, either '+'
> > > > or "+")
> > > > 
> > > > Johannes
> > > > 
> > > > -- 
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > -- 
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to