Firstly, I highly suggest CGI::Simple -- it should be a drop-in replacement for CGI, and therefore relatively painless.

Second, read the docs for the above (depending on which you decide to use). One can modify parameters through the param function in CGI::Simple, for example. I would try to refrain from modifying %ENV directly.

Also, the %ENV represents the environment for your script -- if you do change it (even if it is through use of param()), as soon as your script ends those changes will be lost. The two main ways to pass data around between CGI scripts are sessions and parameters.

Parameters are relatively easy -- especially by making use of the HTML hidden input type:

<input type='hidden' name='my_hidden_var' value='some data here' />
However, you will have to be sure that these parameters will be passed by the browser -- which means every link is a form submission.

Sessions can be implemented a number of ways. The easiest (also the most prone to problems) is to simply set cookies for the values you need to pass around. One can replace or combine this method with file- or database-driven session management, if need be. I highly suggest looking at Ovid's CGI course, which covers such things and points to many useful resources.

Anima Legato
.oO all things connect through the motion of the mind


In reply to Re: CGI lib question by legato
in thread CGI lib question by hok_si_la

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.