SPUG: CGI.pm and browser redirection

Kevin Fink kevin at n2h2.com
Mon Jun 12 20:15:19 CDT 2000


I don't think you can use a Location header along with a 200 response
code.  It requires a 3xx response code.  You'll probably have to use a
meta refresh instead.

Kevin

On Mon, 12 Jun 2000, Christopher Cavnor wrote:

> I have a script that, using CGI.pm, prints stuff to a Web page and redirects
> when finished. Simple right? but I can't get redirect to work. I know that it
> is doe to the header that is printed via CGI.pm, because all is well if I
> disable it. Problem is, I need it - so I was wondering if anyone knows a
> work-around. Here is the setup:
> 
> #!/usr/bin/perl -w
> 
> use strict;
> use CGI::Carp qw/fatalsToBrowser/;
> use CGI qw/:standard/;
> 
> my $html = new CGI;
> print $html->header(-pragma=>'no-cache');
> print $html->start_html;
> 
> print $html->p("stuff");
> 
> print $html->end_html();
> 
> #redirect to ananlysis page when finished
> print $html->redirect(  -location=>'http://207.202.194.220/analysis.html' );
> 
> exit();
> 
> 
> Tried end_html before and after the redirect - no diffy. Appreciate any help,
> thanks!
> 
> Chris
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
>  For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
> 
> 

------------------------------------------------------------------------------
 Kevin Fink <kevin at n2h2.com>          N2H2, Creators of Bess and Searchopolis
 Chief Technology Officer             900 Fourth Avenue, Suite 3400
 http://www.n2h2.com/                 Seattle, WA 98164
 VOICE: 206-336-1501 / 800-971-2622   FAX: 206-336-1541
------------------------------------------------------------------------------


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address





More information about the spug-list mailing list