[Catalyst] session data not always saved?

Nathan Kurz nate at verse.com
Fri Jun 16 01:38:29 CEST 2006


Hello ---

I'm having problems setting and saving session data in certain cases.
In particular, the session data doesn't seem to be saved if I set a
response status and body in the handler.  It seems like I can get
around this by explicity calling $c->_save_session(), but given the
underscore this seems like it must be a hack:

sub index : Private {
    my ($self, $c) = @_;
    $c->session->{test_value} = "Some test value";

    # FIXME: This seems to be necessary if the response codes are set
    $c->_save_session();

    $c->response->status(204);
    $c->response->body( '204 Not Changed' );
}

Is there a better way to do this, or is there a bug whereby session
finalization is not being done if the response is explicitly set?

Thanks!

Nathan Kurz
nate at verse.com



More information about the Catalyst mailing list