nedals has asked for the wisdom of the Perl Monks concerning the following question:
I'm sure this is ridiculously simple, but I'm missing something.
I pass <form> data to script1.cgi.
Based on some criteria I either want to process the data in script1.cgi or pass it, via a post, to script2.cgi.
In that case, script1.cgi ends and the HTML doc is returned to the client from script2.cgi
A search of PM yielded HTTP::Request to local script but it seems that this returns something to script1.cgi which is not what I want.
### script1.cgi use strict; use LWP::UserAgent; use CGI; my $q = new CGI; ## determine if HTML returned from this script OR pass the data to nex +t script. my $name = $q->param('name'); if (use next script) { ## I can do it like this but that does not 'post' the data print "location: script2.cgi?querystring\n\n"; ## OR.... my $ua = LWP::UserAgent->new; # pass one item my $req = POST "/cgi-bin/script2.cgi", [ name => $name ]; # pass all items ?? my $req = POST "/cgi-bin/script2.cgi", $q; print $ua->request($req); exit; } else { &returnHTML(); exit; } ### script2.cgi use strict; use CGI; .. ## process posted data &returnHTML(); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pass 'posted' data to a 'chained' script
by tilly (Archbishop) on Feb 08, 2005 at 06:58 UTC | |
by nedals (Deacon) on Feb 08, 2005 at 08:14 UTC | |
by tilly (Archbishop) on Feb 11, 2005 at 14:13 UTC | |
by dimar (Curate) on Feb 08, 2005 at 15:33 UTC | |
by nedals (Deacon) on Feb 08, 2005 at 18:00 UTC |