On Jun 12, 7:37*pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> Sounds like you don't want to just redirect, after all, but rather
> submit a new query. The libwww-perl family of modules can do that; see
> for instance LWP::UserAgent.
Thank you, Gunnar. After playing with this for a couple weeks (not
full-time), I decided that I ^really^do^ want a redirect, not to
submit a new query. The reason is that I need the user to get a
response from the site that I redirected to, not my redirecting/
tweaking script. I could not find any function in LWP::UserAgent to
do a redirect, so I used CGI.
I have uploaded two "bonehead" scripts:
"Redirector.pl" redirects to "QueryHandler.pl", using CGI's
"redirect" function.
"QueryHandler.pl echoes the query back to the user, using CGI's
"Dump()" function.
Result of Experiments:
If you "go direct", entering into your web browser something like:
http://sheepsystems.com/cgi-test/sal...rry&color=blue
you get your query echoed back to you as expected.
But if you try and do that through my redirect, entering
http://sheepsystems.com/cgi-test/sal...rry&color=blue
it gets redirected OK but you don't get your query pairs echoed back.
This is because QueryHandler.pl does not get the query pairs. (I have
also confirmed this by writing to a log file.)
Is there any way to pass a query through a redirecting script, or am I
expecting something that is fundamentally impossible? (Recall that in
my actual application, the redirecting script will tweak some of the
values in the query.)
Thanks again,
Jerry
******** Redirector.pl *****************
#!/usr/bin/perl
use strict ;
use warnings ;
use CGI ;
my $httpQuery = new CGI;
my $redirectURL = "http://sheepsystems.com/cgi-test/sales/
QueryHandler.pl" ;
print $httpQuery->redirect($redirectURL) ;
exit() ;
******** QueryHandler.pl *****************
#!/usr/bin/perl
use strict ;
use warnings ;
use CGI ;
my $httpQuery = new CGI ;
my $returnBody .= "<p>Module CGI got query list:</p>" ;
my $cgiDump = $httpQuery->Dump() ;
if (defined($cgiDump)) {
$returnBody .= $cgiDump ;
}
# Output to client application
print "Content-type: text/html\n";
print "Status: ", 200, " \n\n";
print "<html>$returnBody</html>" ;
exit() ;