CGI.pm parsing odity
am 16.05.2006 16:01:55 von FrankB
Hello.
With CGI.pm Oo_style coding,
I use a form with GET method, it parses a textfield with name
attribute:
"participant".
I validate that parameter with Perl's substitute and match handlers in
order to make a file in "/tmp/SOMEDIR/" with names like :
"participant.scorefile".
In that file i regulary use the CGI function save() to save the satus
of
the form and it writes away an annoying trainling "=".
$]cat /tmp/SCORES/JohnDoe.sorefile
gives this :
participant=JohnDoe
=
That is "$query save(FHANDLE);" right after the participant puts his
name, so, the *wanted* dated is in there but I don't know where Perl
gets that empty form parameter, is it even empty form data ? Is it an
assignment ? Why this trailing "=" sign ?
Thanks
--
FrankB
Re: CGI.pm parsing odity
am 16.05.2006 18:50:13 von xhoster
you.did@request.yup wrote:
> Hello.
>
> With CGI.pm Oo_style coding,
> I use a form with GET method, it parses a textfield with name
> attribute:
> "participant".
> I validate that parameter with Perl's substitute and match handlers in
> order to make a file in "/tmp/SOMEDIR/" with names like :
> "participant.scorefile".
> In that file i regulary use the CGI function save() to save the satus
> of
> the form and it writes away an annoying trainling "=".
If that is the biggest annoyance you face, you are a lucky man indeed.
>
> $]cat /tmp/SCORES/JohnDoe.sorefile
> gives this :
> participant=JohnDoe
> =
Have you bothered to read the documentation for the method you are using?
from perldoc CGI on save():
Both name and value are URL escaped. Multi-valued CGI
parameters are represented as repeated names. A session
record is delimited by a single = symbol. You can write
out multiple records and read them back in with several
calls to new.
> That is "$query save(FHANDLE);" right after the participant puts his
> name, so, the *wanted* dated is in there but I don't know where Perl
> gets that empty form parameter, is it even empty form data ? Is it an
> assignment ? Why this trailing "=" sign ?
So that you can store multiple sessions states in one file, just as the
documentation says.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
Re: CGI.pm parsing odity
am 16.05.2006 18:50:35 von merlyn
>>>>> "FrankB" == FrankB writes:
FrankB> In that file i regulary use the CGI function save() to save the satus of
FrankB> the form and it writes away an annoying trainling "=".
FrankB> $]cat /tmp/SCORES/JohnDoe.sorefile
FrankB> gives this :
FrankB> participant=JohnDoe
FrankB> =
FrankB> That is "$query save(FHANDLE);" right after the participant puts his name, so,
FrankB> the *wanted* dated is in there but I don't know where Perl gets that empty
FrankB> form parameter, is it even empty form data ? Is it an assignment ? Why this
FrankB> trailing "=" sign ?
That's "Boulder" format. It's the format of some key/value pair thingy
used in the Human Genome Project.
$ perl -MCGI -e 'CGI->new("a=b&c=d&c=e")->save(\*STDOUT);'
a=b
c=d
c=e
=
$
So yes, that trailing = is a sign that all data has been read, apparently.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
*** Posted via a free Usenet account from http://www.teranews.com ***
Re: CGI.pm parsing odity
am 18.05.2006 14:10:34 von FrankB
xhoster@gmail.com pretended :
> you.did@request.yup wrote:
>> Hello.
>>
>> With CGI.pm Oo_style coding,
>> I use a form with GET method, it parses a textfield with name
>> attribute:
>> "participant".
>> I validate that parameter with Perl's substitute and match handlers in
>> order to make a file in "/tmp/SOMEDIR/" with names like :
>> "participant.scorefile".
>> In that file i regulary use the CGI function save() to save the satus
>> of
>> the form and it writes away an annoying trainling "=".
>
> If that is the biggest annoyance you face, you are a lucky man indeed.
Not really, the biggest annoyance is errors in lines due to my own
stupidity or distraction.
>>
>> $]cat /tmp/SCORES/JohnDoe.sorefile
>> gives this :
>> participant=JohnDoe
>> =
>
> Have you bothered to read the documentation for the method you are using?
Not completely : my lazyness took it over and English is not my primary
language, so I thought i could post here and improve my English while
learning Perl in deeper (grinns: "does this count as an excuse ?")
>> Why this trailing "=" sign ?
>
> So that you can store multiple sessions states in one file, just as the
> documentation says.
I will be back on that later, i am still in the documentation now :
testing out, reading, testing, reading..
Thank you for that answer though, it is makes sense but i don't really
get it.
--
FrankB
Re: CGI.pm parsing odity
am 18.05.2006 14:17:54 von FrankB
on 16/05/2006, Randal L. Schwartz supposed :
>>>>>> "FrankB" == FrankB writes:
>
> In that file i regulary use the CGI function save() to save the satus
> of the form and it writes away an annoying trainling "=".
> That is "$query save(FHANDLE);" right after the participant puts his
> name, so, the *wanted* dated is in there but I don't know where Perl
> gets that empty form parameter, is it even empty form data ? Is it an
> assignment ? Why this FrankB> trailing "=" sign ?
>
> That's "Boulder" format.
Thanks for that hint :)
> It's the format of some key/value pair thingy
> used in the Human Genome Project.
>
> $ perl -MCGI -e 'CGI->new("a=b&c=d&c=e")->save(\*STDOUT);'
> a=b
> c=d
> c=e
> =
> $
That is it, STDOUT being a FILEHANDLE but yup, that how it cats.
> So yes, that trailing = is a sign that all data has been read, apparently.
Not an assignment, not an empty key=value pair.. just a naked, lonely
equation/equal sign.. aslike "EOF" or "__END__" ?
--
FrankB