I would like to check whether the session expired in cgiapp_prerun stage,
but got some problem

 

I have the following code extracted.

 

sub setup {

 

my $self = shift;

$self->start_mode('page1');

$self->run_modes(

                     ‘mode1’ => ‘showLogin’,

                     ‘mode6’ => ‘showSessionExpire’,

              );

$self->session_config(

                           .........

                           DEFAULT_EXPIRY      => '+1m',

                           .........

                     );

)

 

Sub cgiapp_prerun (

       my $self = shift;

if ($self->session->is_expired() || $self->session->is_empty()) {

                $self->prerun_mode('page6');

        }

 

        if ($self->session->is_new()) {

                $self->prerun_mode('page1');

        }

                     

)

 

Sub showLogin (

       ...........

)

 

Sub showSessionExpire (

       ...........

)

 

“showLogin” is a page for user to login, and “showSessionExpire” is a pure
html that explain to user that the session is expired.

The condition is that the application will not go to mode “page6”
(showSessionExpire) after I logged in the system and idle for more than 1
min, it just run into “page1”, ie, conition $self->session->is_new() met,
and new session is generated. I checked that CGI-Application-Plugin-Session
manual page and found “This effectively creates a singleton session object
for the duration of the request. CGI::Session will look for a cookie or
param containing the session ID, and create a new session if none is
found.”. Does it mean that expired session will not be loaded, and create a
new session instead?

 

Regards,

Anthony

 

 


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.6/324 - Release Date: 25/04/2006
 

Reply via email to