I probably should be ashamed to say this, but I tend to use the words script and program interchangably. However, I think that the word script is appropriate here as you're (chromatic) implying: Each of my .cgi files have minimal functions (keeping with Unix Philosophy). Some create a web page for displaying a "form" for the user to fill out and "submit" for "post"ing. Some read in data from previous scripts (via CGI.pm and HTML forms and some parsing I ripped off from O'Reilly--subparseform.lib) and process the data (e.g., update a mySQL database). I do have some "require" lines that call upon a couple library (.lib) files that contain common functions. Maybe these are causing me trouble.
Alright, now we're getting complicated and getting involved too much in fixing my immediate problem, which isn't as important for me as my grasping the concept of "new CGI" (and I guess from what you're telling me, object oriented programming). Grasping the concept, I believe, will solve the immediate problem and future ones.
You mentioned that if I call new() within the same process, I'll run into trouble. This seems to be the effect (the trouble, that is) that I'm experiencing. It also seems to be touching on the subtle conceptual aspect that I was suspecting: namely, although I may use new() in two separate .cgi files, by passing data from one to the other in this object bundle, as you put it, or $q, as I coded it, am I wiping out the data within $q with another new() in the second script by invoking it before I can parse the data into my string variables? Boy, that was a long-winded question. Put simply, if I were to alternate from $q and $x, or if I were to not declare new() until after I parse and save my data into string variables, would that solve my problem? Okay, another long-winded sentence--it seems unavoidable for me when discussing such a concept and trying to apply it. I'll stop here and let you and others respond, if you all would be so kind.
Oh, and thanks for all of the postings thus far. They have been helpful. I've been playing with the practical suggestions and pondering the conceptual ones. I think I'm getting closer. Of course, that may yet to be determined.
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>
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
Want more info? How to link or
or How to display code and escape characters
are good places to start.