AxKit-XSP-Minisession

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

license: artistic
meta-spec: 
  url: http://module-build.sourceforge.net/META-spec-v1.3.html
  version: 1.3
name: AxKit-XSP-Minisession
no_index: 
  directory: 
    - inc
    - t
requires: 
  Apache::Cookie: 0
  Apache::Log: 0
  Apache::Session::File: 0
  AxKit: 1.62
  mod_perl: 0
  perl: 5.8.0
tests: t/*.t
version: 1.10000

Makefile.PL  view on Meta::CPAN

use File::Path;

name 'AxKit-XSP-Minisession';
license 'artistic';
perl_version '5.008000';
all_from 'lib/AxKit/XSP/Minisession.pm';

requires 'AxKit'                 => 1.62;
requires 'Apache::Log';
requires 'Apache::Session::File';
requires 'Apache::Cookie';
requires 'mod_perl';

my $sessiondir = catfile('t', 'htdocs', 'session');
my $sessionlockdir = catfile('t', 'htdocs', 'sessionlock');

tests 't/*.t';
clean_files "smoke-report-* t/TEST t/SMOKE t/logs $sessiondir $sessionlockdir";

eval {
    system 'pod2text lib/AxKit/XSP/Minisession.pm > README';

lib/AxKit/XSP/Minisession.pm  view on Meta::CPAN

          .", ". Apache::AxKit::Language::XSP::makeSingleQuoted($attr{$_})
            .");\n"
            for keys %attr;
        return $buildup;
    }
}

package AxKit::XSP::Minisession::Backend;
use Apache::Log;
use Apache::Session::File;
use Apache::Cookie;
use strict;
use warnings;

sub get_session {
    my $r = shift;
    my $sid;

    if (!($sid = $r->pnotes("SESSION_ID"))) {
        # Has it come from a cookie?
        my %jar = Apache::Cookie->new($r)->parse;
        if (exists $jar{sessionid}) {
            $sid = $jar{sessionid}->value();
            $r->log->debug("Got the session id ($sid) from a cookie");
        }
    }

    $sid = undef unless $sid; # Clear it, as 0 is a valid sid.
    my %session = ();
    my $new = !(defined $sid);

lib/AxKit/XSP/Minisession.pm  view on Meta::CPAN

    if ($new) {
       put_session($r, \%session);
    }
    return \%session;
}

sub put_session {
    my ($r, $sess_ref) = @_;
    $r->log->debug("Returning session ".$sess_ref->{_session_id}." to the cookie
    jar");
    my $cookie = Apache::Cookie->new($r,
        -name => "sessionid",
        -value => $sess_ref->{_session_id},
        -path => "/"
    );
    $cookie->bake();
    $r->pnotes("SESSION_ID", $sess_ref->{_session_id});
}

sub get_value {
    my $r = shift;



( run in 0.448 second using v1.01-cache-2.11-cpan-e9199f4ba4c )