Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I'm working on a project for work and I have been using the  Near the top of my scripts, I put the following lines, among others:

use CGI qw/: standard/; my $q = new CGI;

This allows me to do lines like this:

print $q->redirect(-location=> "otherscript.cgi?ord_id=$ord_id");

However, I have been running into some problems with passing data from one script to the next (i.e., order numbers).  If the script that has the line "new CGI" sends data to another script that also has "new CGI", the data seems to get wiped out by that line in the second script.  I tried modifying the line in the second script to read just:

my $q = CGI;

That solved the passing problem, but it seemed to make the other "print $q->" type lines a little flat or they did odd things.  I know, I'm being vague, but I'm recalling symptoms from frustrating moments.  I tried alternating between "new" and not "new", but that doesn't always work.  I'm just running around in circles putting out fires and starting other ones.

In summary, I don't know what "my $q = new CGI;" does.  Therefore, I don't know when to use it and how to modify it.  Can someone explain to me the concepts behind it so I'll know what to do, please?  Thanks.

In reply to Conceptualizing by Spenser

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2022-08-12 15:45 GMT
Find Nodes?
    Voting Booth?

    No recent polls found