What are you two talking about? If you load the session before it expires, the timer does gets re-set, like I already showed.
#!/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"; } for my $loop ( 1 .. 4 ) { sleep 1; my $bob = CGI::Session->load($oneid) or die CGI::Session->errstr; print "one second later $bob / $oneid load\n"; } for my $loop ( 1 .. 4 ) { 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"; } } ## end for my $loop ( 1 .. 4 ) { 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(0xa965fc) / cf27e3ec9ff5a06a5bef449 +1e830c8b6 load one second later CGI::Session=HASH(0x97a164) / cf27e3ec9ff5a06a5bef449 +1e830c8b6 load one second later CGI::Session=HASH(0xbef68c) / cf27e3ec9ff5a06a5bef449 +1e830c8b6 load one second later CGI::Session=HASH(0xbef56c) / cf27e3ec9ff5a06a5bef449 +1e830c8b6 load two seconds later var=value two seconds later var=value two seconds later var=value two seconds later var=value three seconds later CGI::Session=HASH(0xa965ec) / cf27e3ec9ff5a06a5be +f4491e830c8b6 is_expired

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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.