LadyD has asked for the wisdom of the Perl Monks concerning the following question:
My CGI code needs to do this:
So there are two sources for name/value pairs: the flat file and the HTML posts. These two sources have the same variables consistently throughout the application. I created two CGI objects, one for each source. And in my naiveté called them both $q, to save myself having to figure out how to pass the variables from one object into another inside of the code. Samples:
Getting the name/value pairs from the HTML form post:
$q = new CGI; { my $q = shift; my %query_hash; foreach ( $q->param() ) { $query_hash{$_} = $q->param($_); } return %query_hash; }
Getting the name/value pairs from the flat file:
{ open (REVIEW, "<review.txt") or die "can't open review.txt!"; $q = new CGI("REVIEW"); close (REVIEW); }
Saving the name/value pairs to the flat file: $q->save("NEWREVIEW");
I ran this by TGI and he's not sure how kosher it is to have 2 CGI objects with the same name, and he's not sure if using $q->save is a good idea. He told me to put the question before y'all.
Any advice? I'll take anything you can give-
Thanks,
LadyD
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple CGI Objects w/ Same Name
by voyager (Friar) on Jul 11, 2001 at 02:30 UTC | |
|
Re: Multiple CGI Objects w/ Same Name
by TGI (Parson) on Jul 11, 2001 at 03:12 UTC | |
|
Re: Multiple CGI Objects w/ Same Name
by synapse0 (Pilgrim) on Jul 11, 2001 at 13:12 UTC | |
|
Re: Multiple CGI Objects w/ Same Name
by adzap (Initiate) on Jul 11, 2001 at 15:29 UTC | |
by synapse0 (Pilgrim) on Jul 11, 2001 at 22:27 UTC | |
|
Re: Multiple CGI Objects w/ Same Name
by sierrathedog04 (Hermit) on Jul 11, 2001 at 05:27 UTC |