* On Fri, Mar 14 2008, Alexandre Jousset wrote:
> To set the longer expiry time, I try:
>
> $c->config->{session}{expires} = 31536000 if $c->req->param('remember_me');

You can't write to $c->config after setup runs.  It just doesn't make
sense.

Anyway, config->{session}{expires} is only consulted at session creation
time.  If you need to change the expiration later, you need to do
something else.

This might work:

  sub MyApp::calculate_extended_session_expires {
      my ($c, $prev) = @_;
      if($c->session->{remember_me}){
          return time + 31536000;
      }
      else {
          return $c->NEXT::calculate_extended_session_expires($prev);
      }
   }

And then

   $c->session->{remember_me} = 1;
   $c->calculate_extended_session_expires;

Untested.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to