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
In reply to Multiple CGI Objects w/ Same Name by LadyD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |