1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
package TestAppCGISimple;
use strict;
use CGI::Application;
use CGI::Application::Plugin::Session;
@TestAppCGISimple::ISA = qw(CGI::Application);
sub cgiapp_init {
my $self = shift;
$self->session_config(CGI_SESSION_OPTIONS => [ "driver:File", $self->query ]);
}
sub setup {
my $self = shift;
$self->start_mode('test_mode');
$self->run_modes(test_mode => 'test_mode' );
}
sub test_mode {
my $self = shift;
my $output = '';
my $session = $self->session;
$output .= $session->is_new ? "session created\n" : "session found\n";
my $value = $session->param('value') || "";
$output .= "value=$value\n";
$output .= "id=".$session->id."\n";
$output .= "query=".ref($self->query)."\n";
$session->param('value' => 'test1');
return $output;
}
1;
|