[Catalyst] Unnecessary session writes

Bill Moseley moseley at hank.org
Wed Dec 17 05:11:38 GMT 2008

On Tue, Dec 16, 2008 at 06:20:43PM +0000, Tomas Doran wrote:
> Do you fancy writing a test for the issue so we can actually prove it is 
> gone?

Well, it would could be something like this:

use lib "t/lib";
use Test::WWW::Mechanize::Catalyst "SessionTestApp";

$SessionTestApp::store_session_data = 0;
my $wrote_session;
    no warnings 'redefine';
    *SessionTestApp::store_session_data = sub {
        $wrote_session++ if $_[1] =~ /^session:/;

my $ua = Test::WWW::Mechanize::Catalyst->new;

$ua->get_ok( 'http://localhost/login', 'call $c->session'  );
ok( !$wrote_session, 'Did not write session on read only' );

But, the plugin also always writes an "expires:" key into the store
(hence the /^session:/ match above), so if the goal is to not write to
the store unless there's something to store then that needs looking
at, too.

Bill Moseley
moseley at hank.org
Sent from my iMutt

More information about the Catalyst mailing list