How to send arguments with a redirect?
| Newsgroups | perl.beginners.cgi |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <9b43333e-e4a2-4c8b-a157-5c06616d0b11@r32g2000vba.googlegroups.com> |
Hi
I have the following two scripts test.cgi & displaytest.cgi
test.cgi is intended to redirect itself to displaytest.cgi and send
some arguments.
The problem I am having is that I can never get the arguments
successfully sent!
Redirect without arguments works fine - but the various approached
I've tried to send arguments all fail.
I would really appreciate some help with this - I'm sure/hope it's a
simple syntax issue
Thanks
NJH
test.cgi
---------
#!c:/perl/bin/perl.exe
use strict;
use warnings;
use CGI;
my $q = new CGI;
my %args =
(
'nev' => 'hi',
'hod' => 'ho'
);
print $q->redirect(-url=>'http://pubswww.kl.imgtec.org:8080/cgi-bin/
displaytest.cgi'); # No arguments works
print $q->redirect(-url=>'http://pubswww.kl.imgtec.org:8080/cgi-bin/
displaytest.cgi', \%args); # This fails
print $q->redirect # # This fails too!
(
-url=>'http://pubswww.kl.imgtec.org:8080/cgi-bin/
displaytest.cgi',
-nph=>1,
{
'never' => 'hi',
'happen' => 'ho'
}
);
print "Content-Type: text/html\n\n",
"The redirect seems to have failed.";
---
displaytest.cgi
---------------
#!c:/perl/bin/perl.exe
use warnings;
use strict;
use diagnostics;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $q = new CGI;
print $q->header(),
$q->start_html(),
'<h1>Test redirection</h1>';
print "Args: ", $q->param(), "<br>";
foreach my $param($q->param())
{
print "Initial: $param, Value: ",$q->param($param),"<br>";
}
$q->end_html;
exit();