Cees:

> That is odd, as it usually works out of the box without requiring any
> configuration.

You're absolutely right. I was just trying too hard. After commenting out
session_config and having it work, I successfully added back in:

     $self->session_config( DEFAULT_EXPIRY      => '+15m');

As I am finding with all of C::A stuff (this being my first week using
C::A and the plug-ins) is that it's almost *too* easy. I was telling a
fellow coder, who has yet to make the switch, that I'm incredulous
everytime I use a new plug-in (once I get them installed).

Anyway, hats off to all those who have contributed to the C::A way, the
Perlmonks that pushed me in the first place (guilt),  and for this
list-serve that has made the jump so much easier for me.

Brad



> On 12/16/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
>> Seems like I have spent more time on C::A::P::Session than all the other
>> plugins combined--and I just can't get it to work.
>
> That is odd, as it usually works out of the box without requiring any
> configuration.
>
>> It is setting a session
>> in cgiapp_postrun after logging in for the first time (it is also
>> setting
>> a cookie very nicely). This is evidenced by the line: 'logged_in: 1" in
>> my
>> debug2.txt file and the visual setting of the cookie.
>>
>> However, when I come return from the next HTML page to execute another
>> runmode, the session is coming up empty. This is evidenced by the line:
>> 'logged_in: ' in my debug1.txt file.
>>
>> In good olde CGI::Session, I have to use the session id to retrieve the
>> session:
>>
>>    my $session_id = cookie('CGISESSID');
>>    my $session = new CGI::Session("driver:File", $session_id,
>> {Directory=>'/tmp'});
>
> Actually, you don't have to do that with CGI::Session, you can just
> give it a CGI.pm object and it will figure out the session_id from
> that.  That is the technique that CAP::Session uses.
>
>> I see that an id is created in the cookie by C::A::P::S, but how is it
>> use
>> to retrieve the session, if at all? Here's my bare bones code:
>>
>> sub cgiapp_init {
>>    my $self = shift;
>>
>>    $self->session_config(
>>        CGI_SESSION_OPTIONS => [ "driver:File", $self->query,
>> {Directory=>'/tmp'} ],
>>        DEFAULT_EXPIRY      => '+15m',
>>        COOKIE_PARAMS       => { -name    => 'designsoft',
>>                                 -path    => '/'},
>>        SEND_COOKIE         => 1);
>
> What you are doing here is telling CAP::Session to use a different
> name for the cookie.  The docs for CAP::Session warn you about doing
> that.  My recommendation would be to comment out your entire
> 'session_config'  line and let CAP::Session use its defaults.  That
> should work for everyone.  Then you can start adding customizations in
> and test as you make changes.  That way you will figure out where
> things are going wrong.
>
> Cheers,
>
> Cees
>
>


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to