in reply to try to send cookie and redirect

This snippet works in one of my applications just fine, I think it meets your requiremeents for the most part. This is from a web-based login that redirects to the calling script.

Create and set cookie, then redirect.

my $cookie_name = "FOO" . $E . "SID"; my $SID_cookie = new CGI::Cookie(-name => $cookie_name, -value => $sid, -path => '/', -expires => "+2h", -domain => '.foobar.com', ); print "Set-Cookie: " . $SID_cookie . "\n"; print $q->redirect("$redirectURL");

Replies are listed 'Best First'.
Re: Re: try to send cookie and redirect
by Kanji (Parson) on Apr 22, 2002 at 23:12 UTC

    If you used CGI's named arguments-style, there's no need to craft your own 'Set-Cookie' header: redirect will do it for you, just like header.

    print $cgi->redirect( -uri => $new_url, -cookie => $cookie );

        --k.


Re: Re: try to send cookie and redirect
by Georgio (Sexton) on Apr 25, 2002 at 07:41 UTC

    It works just fine!
    Thanks a lot!