Apache-Session-Counted
view release on metacpan or search on metacpan
lib/Apache/Session/Counted.pm view on Meta::CPAN
if (exists $session->{args}{HostURL}) {
$surl = $session->{args}{HostURL}->($host,$sessionID);
} else {
$surl = sprintf "http://%s/?SESSIONID=%s", $host, $sessionID;
}
# warn "surl[$surl]";
if ($surl) {
require LWP::UserAgent;
require HTTP::Request::Common;
my $ua = LWP::UserAgent->new;
$ua->timeout($session->{args}{Timeout} || 10);
my $req = HTTP::Request::Common::GET $surl;
my $result = $ua->request($req);
if ($result->is_success) {
$content = $result->content;
} else {
$content = Storable::nfreeze {};
}
} else {
$content = Storable::nfreeze {};
}
lib/Apache/Session/Counted.pm view on Meta::CPAN
=head1 SYNOPSIS
tie %s, 'Apache::Session::Counted', $sessionid, {
Directory => <root of directory tree>,
DirLevels => <number of dirlevels>,
CounterFile => <filename for File::CounterFile>,
AlwaysSave => <boolean>,
HostID => <string>,
HostURL => <callback>,
Timeout => <seconds>,
}
=head1 DESCRIPTION
This session module is based on Apache::Session, but it persues a
different notion of a session, so you probably have to adjust your
expectations a little.
The dialog that is implemented within an HTTP based application is a
nonlinear chain of events. The user can decide to use the back button
lib/Apache/Session/Counted.pm view on Meta::CPAN
environment. Two arguments are passed to this callback: HostID and
Session-ID. The URL must return the serialized data in Storable's
nfreeze format. The Apache::Session::Counted module can be used to set
such an URL up. If HostURL is not defined, the default is
sprintf "http://%s/?SESSIONID=%s", <host>, <session-ID>;
The callback can return false to signal that there is no session to
retrieve (e.g. when the host or id argument is illegal).
=item Timeout
Sets the timeout for LWP::UserAgent for retrieving a session from a
different host. Default is 10 seconds.
=back
=head2 What this model buys you
=over
( run in 0.233 second using v1.01-cache-2.11-cpan-4d50c553e7e )