Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: CGI::Application redirect loses cookie

by Your Mother (Archbishop)
on Jan 06, 2009 at 04:32 UTC ( #734343=note: print w/replies, xml ) Need Help??


in reply to CGI::Application redirect loses cookie

Here's a small proof that that "other coder" is no friend of yours.

use strict; use warnings; use CGI qw(:standard); use URI; my $uri = URI->new( url() ); $uri->query(undef); if ( my $redirect = param("redirect") ) { my $cookie = cookie( -value => $redirect, -name => "nom" ); print redirect( -uri => $uri, -cookie => $cookie, -status => 302 ); } else { my $cookie_value = cookie("nom"); my $cookie = cookie( -value => "cleared", -name => "nom" ); print header(-cookie => $cookie), start_html("Redirection with Cookies and Milk"), h1("OH HAI, I CAN HAZ COOKEE?"), h2("Nom, nom: ", $cookie_value), start_form(), radio_group( -name => "redirect", -value => [ qw( A one two three ) ], ), submit(), end_form(), end_html(); }

Just verified to work in IE (6), FF, and Safari. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://734343]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2022-08-08 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?