On 4/27/06, Ed Pigg <[EMAIL PROTECTED]> wrote:
> The doc's for CGI::Application::Plugin::Session state
>
> > NOTE: If you change the name of the cookie by passing a -name
> > parameter, remember to notify CGI::Session of the change by calling
> > CGI::Session->name('new_cookie_name').
>
> At what point is this call made? In the Session options? Before the
> session_config or after?
>
> In my Base package I have the following init.
>
> sub cgiapp_init {
>         my $self = shift;
>
>         $self->session_config(
>                 CGI_SESSION_OPTIONS     => [ "driver:mysql", $self->query, { 
> DataSource
> => $ENV{DB_DSN},                                                              
>                           User            => $ENV{DB_USER},
>                                                                         
> Password        => $ENV{DB_PWD}
>                                                                         } ],
>                 COOKIE_PARAMS           => {    -name => 'MYCOOKIENAME',
>                                                 -expires => "+1y",
>                                                 -path => '/', },
>                 SEND_COOKIE             => 1,
>         );
> }

I think those docs may be a little out of date.  The send_cookie
mechanism in CAP::Session checks with CGI::Session to find out what
the cookie name is, and uses that.  So you do not need to use
COOKIE_PARAMS => { -name => 'MYCOOKIENAME' }.

All you really need to do is call:

CGI::Session->name('MYCOOKIENAME')

And you can just put that in the global scope of your program (right
after you load CAP::Session if you like)

Just remember that if you are using mod_perl or another persistent
environment that this will change the cookie name for all applications
that run under the perl interpreter (CGI::Session keeps the name as a
global variable).

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