The easy way to test is to examine you stored session. Create your new session, check the expiry time in you database/file. Access your web page again and see if your expiry time has changed.
Now that you know HOW to check when you session is expired, you next need to look and see how you want your session to expire. If you are looking to check Idle time, well you need to reset the expiry value for the session EVERY time the user accesses the session
my $session = CGI::Session->load();
if ($session->is_expired) {
# Do something like refresh the page
}
else {
$session->expiry("+5m");
# Wait another 5 minutes
}
There is nothing magical about how CGI::Session handles expiration. You set an initial expiration and that is it. By default, it will not reset the expiration value for you. There is no hidden value that deals with idle time.
-
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 How to display code and escape characters
are good places to start.
|