[cgiapp] Plack::Session and CGI::Application
max.augsburg at gmx.de
max.augsburg at gmx.de
Sun Nov 27 17:27:36 EST 2016
Hello all,
I don't know whether I am completely stumped but I didn't get
Plack::Middleware::Session to work.
My simple PSGI script is as follow:
my $app = sub {
my $env = shift;
my $webapp = PLogPSGI->new( QUERY => CGI::PSGI->new($env),
[bla bla bla]
'env' => $env
}
);
$webapp->run_as_psgi();
};
builder {
enable 'Session';
$app;
};
and my PLogPSGI module looks for example in cgiapp_prerun as follows:
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');
}
}
I get the following error:
Error 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
If I comment out the cgiapp_prerun lines I can look at the PSGI hash
$env. $env->{'psgix.session'} is empty...
I saw Ron Savages introduction (
http://savage.net.au/Perl/html/session.management.with.plack.html )
But unfortunately it doesn't help me.
Thanks in advance,
Max
More information about the cgiapp
mailing list