Praveena Vittal wrote:

#!/usr/bin/perl
use CGI;
my $query =new CGI;

<----some other stuffs will be here-->
print $query->redirect('http://google.com');


When i run this code

How do you run it? Is the script URL in the action attribute when POSTing an HTML form? In that case, and if you want the request to be redirected, the _only_ code you need is:

    #!/usr/bin/perl
    print "Status: 307\nLocation: $location\n\n";

i am getting a blank page with the following printed in the screen...

Status: 302 Moved Location: http://google.com

and not redirecting to the url given...

That's because your "other stuffs" includes printing of two consecutive line breaks. Maybe you had

    print $query->header;

there, which you shouldn't have in the case of a redirect.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to