bradcathey has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monasterians,

I'm trying to set up a test scenario of for a larger application that will have several called modules and one "super class", hence the 3 chunks of code.

I've set up this test in two places: 1) my shared hosting account at Pair Networks, 2) my dedicated server (running Apache2, Debian 4). It will write a cookie at Pair, but not on my dedicated. The only thing I can come up with is that there is some module at Pair that is making the difference. Anyway, here's what I have.

Instance script in the root

#!/usr/bin/perl use warnings; use strict; use lib "/var/www/dspx/"; use Cookietest; my $app = Cookietest->new(); $app->run();

Super class

package Cookiesuper; use strict; use lib '/var/www/dspx/'; use CGI::Carp qw(fatalsToBrowser); use base 'CGI::Application'; use CGI::Application::Plugin::Session; sub cgiapp_init { my $self = shift; $self->session_config( DEFAULT_EXPIRY => '+4h', COOKIE_PARAMS => { -expires => '+4h', -name => 'DSO_Cookietes +t' }); } 1;

Called module

package Cookietest; use strict; use base 'Cookiesuper'; sub setup { my $self = shift; $self->start_mode('s'); $self->mode_param('rm'); $self->run_modes( 's' => 'somesub', ); } sub somesub { my $self = shift; $self->session->param('test' => 'dso'); return; } 1;

What am I totally missing, or what can I look for, test for to get this working? Thanks in advance.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re: CAP::Session not writing cookie
by wfsp (Abbot) on Nov 22, 2007 at 09:02 UTC
    Not sure if this helps.

    Recent* versions of CGI::Session use a recent version of Scalar::Util which includes S::U::refaddr (earlier versions don't).

    I had a mismatch where it worked on my local m/c but not on my hoster (who had an early verison of S::U). Data in the session was silently corrupted and it took quite a while to track it down.

    It may be worth checking the versions of these modules.

    * For some definition of recent.

Re: CAP::Session not writing cookie
by jbert (Priest) on Nov 22, 2007 at 09:49 UTC
    No idea really, but I'd test with a cmdline tool (wget, curl or GET/HEAD from LWP) rather than a browser, so you can check the HTTP response coming back. Also, make sure you are using a full hostname (with dots in it) rather than a local alias for your dedicated server.

    Browsers can be fickle things regarding when they honour cookies (depends on hostname and settings).