Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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).

In reply to Re^3: CGI::Session - expiry by Anonymous Monk
in thread CGI::Session - expiry by 2ants

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2022-08-15 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?