in reply to Re: Redirects and CGI.pm
in thread Redirects and CGI.pm

my $query = CGI::new(); my $cookie_name = $query->cookie(-name => 'MYHASH', -value => \%hash); print $query->header(-cookie=>$cookie_name); print query->redirect('http://somewhere.else/in/movie/land');
code. The second answer, stating that redirect & header are basicallyt he same is what i needed. Thank you.

Replies are listed 'Best First'.
Re: Re: Re: Redirects and CGI.pm
by mfriedman (Monk) on Oct 02, 2002 at 19:30 UTC
    Therein lies your problem. A redirect is part of the HTTP header; once you print the header (via the header() method) you can't print another one. Try:

    print $query->header(-cookie => $cookie_name, -location => 'http://www.somewhere-else.com/');