CGI.pm parsing odity

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default CGI.pm parsing odity

    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


    FrankB Guest

  2. Similar Questions and Discussions

    1. Parsing U3D
      Does anyone know if there is an Adobe SDK to parse the U3D contained within an Acrobat document? I know it is fairly easy to extract it, and the...
    2. parsing XML
      Why won't this work? I just want to create one Node for each <placemark> tag in the xml. the xmlData trace gets: <kml...
    3. Parsing URL
      How do I go about parsing a url from the browser location. For example if I have the following url: ...
    4. Parsing PHP
      I am using PHP to develop and web app. The app also has a scripting language for the *end user*. I was thinking if I could expose a very simple...
    5. [PHP] Parsing PHP
      There is the tokenizer extension... http://www.php.net/tokenizer This might give you a good start. -- Peter James petej@phparch.com ...
  3. #2

    Default Re: CGI.pm parsing odity

    [email]you.did@request.yup[/email] 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

    --
    -------------------- [url]http://NewsReader.Com/[/url] --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    xhoster@gmail.com Guest

  4. #3

    Default Re: CGI.pm parsing odity

    >>>>> "FrankB" == FrankB <you.can@request.yup> 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
    <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
    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 [url]http://www.teranews.com[/url] ***
    Randal L. Schwartz Guest

  5. #4

    Default Re: CGI.pm parsing odity

    [email]xhoster@gmail.com[/email] pretended :
    > [email]you.did@request.yup[/email] 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


    FrankB Guest

  6. #5

    Default Re: CGI.pm parsing odity

    on 16/05/2006, Randal L. Schwartz supposed :
    >>>>>> "FrankB" == FrankB <you.can@request.yup> 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


    FrankB Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139