[Catalyst] Make Catalyst NOT reset a cookie on a per action basis

Tomas Doran bobtfish at bobtfish.net
Mon Aug 17 21:33:32 GMT 2009


On 16 Aug 2009, at 19:59, Steve Kleiman wrote:
> WHAT I CAN SEE:
> Catalyst engine calls "finalize_cookies" which resets every cookie  
> it finds. This takes place before the 'begin' method and the 'Set- 
> Cookie' header has already been dispatched. Therefore removing that  
> header in 'begin' does nothing. If the original request did not  
> present a cookie, then Catalyst does not regurgitate the cookie and  
> everything works great.
>
> Thanks for any guidance. It'd be great of there's a solution that  
> doesn't require constraining the cookie path.

How about:

after 'finalize_cookies' => sub {
     my $c = shift;
     $c->res->cookies({}) if $c->stash->{no_cookies};
};

in your MyApp.pm, then just arrange for things to set $c->stash- 
 >{no_cookies}?

Cheers
t0m



More information about the Catalyst mailing list