I have a Starman based server -
#!/usr/bin/perl
use strict;
use warnings;
use Data::Printer;
use Plack::Builder;
my $app = sub {
my $env = shift;
my $session = $env->{'psgix.session'};
# Print environment variables
p($env);
return [
200,
[ 'Content-Type' => 'text/plain' ],
[ "Hello, you've been here for ", $session->{counter}++, "th time!" ],
];
};
my $default = sub {
my $env = shift;
p($env);
return [
'200', [ 'Content-Type' => 'text/html' ],
["Welcome to default page"],
];
};
builder {
mount "/validate" => builder {
enable "Middleware::Authentication"
enable "Session";
$app;
};
mount "/" => builder { $default };
};
My own middleware "Authentication" authenticate the user and return session information(expiry time, session key etc) for the session management, So how can i make use of these information in the Session Middleware?