Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: CGI::Session - expiry

by Anonymous Monk
on Mar 13, 2010 at 01:05 UTC ( #828380=note: print w/ replies, xml ) Need Help??


in reply to Re^2: CGI::Session - expiry
in thread CGI::Session - expiry

be considered as a session's last access? If not, what can?

I would say for the whole session yes, but not for individual values. I would also test to check.

#!/usr/bin/perl -- use strict; use warnings; use CGI(); use CGI::Session(); my ($oneid); { my $one = CGI::Session->new or die CGI::Session->errstr; $one->expire('3s'); $one->param(qw' var value '); $oneid = $one->id; print "set exire to 3 seconds\n"; } { sleep 1; my $bob = CGI::Session->load($oneid) or die CGI::Session->errstr; print "one second later $bob / $oneid load\n"; } { sleep 2; my $bob = CGI::Session->load($oneid) or die CGI::Session->errstr; print "two seconds later "; if ( $bob->is_expired ) { print "$bob / $oneid is_expired\n"; } else { print "var=", $bob->param('var'), "\n"; } } { sleep 3; my $bob = CGI::Session->load($oneid) or die CGI::Session->errstr; print "three seconds later "; if ( $bob->is_expired ) { print "$bob / $oneid is_expired\n"; } else { print "var=", $bob->param('var'), "\n"; } } __END__ set exire to 3 seconds one second later CGI::Session=HASH(0x182d050) / 6c9785d1a7916299004b02 +be2ab6ccd7 load two seconds later var=value three seconds later CGI::Session=HASH(0x2260b8) / 6c9785d1a7916299004 +b02be2ab6ccd7 is_expired
As you can see, loading is considered access (no big surprise there).


Comment on Re^3: CGI::Session - expiry
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://828380]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (16)
As of 2014-07-25 15:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (172 votes), past polls