1
2
3
4
5
6
7
8
9
10
11
12
13
my $app = sub {
my $env = shift;
my $webapp = MyApp->new( QUERY => CGI::PSGI->new($env),
[bla bla bla]
'env' => $env
}
);
$webapp->run_as_psgi();
};
builder {
enable 'Session';
$app;
};
1
2
3
4
5
6
7
8
9
10
11
12
13
sub cgiapp_prerun {
my $self = shift;
my $current_runmode = shift;
# initialize the session
my $q =$self->query;
my $env = $q->env;
my $session = $env->{'psgix.session'};
# Check the Login Status and if the user is logged in, start the chosen action
my $login = $session->get('login');
unless ($login) {
$self->prerun_mode('show_login') if ($current_runmode ne 'login_cb');
}
}
QuoteError executing class callback in prerun stage: Can't call method "get" on unblessed reference at /home/maximilian/public_html/cgi-bin/./lib/PLogPSGI.pm line 63. at /home/maximilian/public_html/cgi-bin/extlib/lib/perl5/CGI/Application.pm line 2449
QuoteNOTE: As of version 0.04 the session is stored in psgix.session instead of plack.session.