Apache2-WebApp-Plugin-Session-File

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

abstract: Store persistent data on the filesystem
version: 0.14
author:
  - Marc S. Brooks <mbrooks@cpan.org>
license: perl
distribution_type: module
requires:
  Apache::Session::File: 1.01
  Apache::Session::Lock::File: 1.01
  Apache2::WebApp: 0.38
  Apache2::WebApp::Plugin::Cookie: 0.09
  Apache2::WebApp::Plugin::Session: 0.14
  Params::Validate: 0
build_requires:
  Apache::Test: 0
resources:
  license: http://dev.perl.org/licenses/
meta-spec:
  version: 1.4
  url: http://module-build.sourceforge.net/META-spec-v1.4.html

Makefile.PL  view on Meta::CPAN


WriteMakefile(
    NAME         => 'Apache2::WebApp::Plugin::Session::File',
    VERSION_FROM => 'lib/Apache2/WebApp/Plugin/Session/File.pm', # finds \$VERSION
    AUTHOR       => 'Marc S. Brooks (mbrooks@cpan.org)',
    PREREQ_PM => {
        'Apache::Test'                     => 0,
        'Apache::Session::File'            => 1.01,
        'Apache::Session::Lock::File'      => 1.01,
        'Apache2::WebApp'                  => 0.38,
        'Apache2::WebApp::Plugin::Cookie'  => 0.09,
        'Apache2::WebApp::Plugin::Session' => 0.14,
        'Params::Validate'                 => 0,
    },
    clean => {
        FILES => "@{ clean_files() }",
    }
);

sub clean_files {
    return [@scripts];

README  view on Meta::CPAN

DESCRIPTION
    Store persistent data on the filesystem while maintaining a stateful
    session using web browser cookies.

PREREQUISITES
    This package is part of a larger distribution and was NOT intended to be
    used directly. In order for this plugin to work properly, the following
    packages must be installed:

      Apache2::WebApp
      Apache2::WebApp::Plugin::Cookie
      Apache2::WebApp::Plugin::Session
      Apache::Session::File
      Apache::Session::Lock::File
      Params::Validate

INSTALLATION
    From source:

      $ tar xfz Apache2-WebApp-Plugin-Session-File-0.X.X.tar.gz
      $ perl MakeFile.PL PREFIX=~/path/to/custom/dir LIB=~/path/to/custom/lib

README  view on Meta::CPAN


      [session]
      storage_type = file
      expires = 1h

OBJECT METHODS
    Please refer to Apache2::WebApp::Plugin::Session for method info.

SEE ALSO
    Apache2::WebApp, Apache2::WebApp::Plugin,
    Apache2::WebApp::Plugin::Cookie, Apache2::WebApp::Plugin::Session,
    Apache::Session, Apache::Session::File, Apache::Session::Lock::File

AUTHOR
    Marc S. Brooks, <mbrooks@cpan.org> - <http://mbrooks.info>

COPYRIGHT
    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

    See <http://dev.perl.org/licenses/artistic.html>

lib/Apache2/WebApp/Plugin/Session/File.pm  view on Meta::CPAN

    }

    foreach my $key (keys %$data_ref) {
        $session{$key} = $data_ref->{$key};     # merge hash key/values
    }

    my $id = $session{_session_id};

    untie %session;

    $c->plugin('Cookie')->set( $c, {
        name    => $name,
        value   => $id,
        expires => $c->config->{session_expires} || '24h',
      });

    return $id;
}

#----------------------------------------------------------------------------+
# get( \%controller, $arg )

lib/Apache2/WebApp/Plugin/Session/File.pm  view on Meta::CPAN

          { type => OBJECT  },
          { type => HASHREF },
          { type => SCALAR  }
          );

    $self->error('Malformed session identifier')
      unless ( $arg =~ /^[\w-]{1,32}$/ );

    my $doc_root = $c->config->{apache_doc_root};

    my $cookie = $c->plugin('Cookie')->get($arg);

    my $id = ($cookie) ? $cookie : $arg;

    my %session;

    eval {
        tie %session, 'Apache::Session::File', $id, {
            Directory     => "$doc_root/tmp/$arg/session",
            LockDirectory => "$doc_root/tmp/$arg/lock",
          };

lib/Apache2/WebApp/Plugin/Session/File.pm  view on Meta::CPAN

          { type => OBJECT  },
          { type => HASHREF },
          { type => SCALAR  }
          );

    $self->error('Malformed session identifier')
      unless ( $arg =~ /^[\w-]{32}$/ );

    my $doc_root = $c->config->{apache_doc_root};

    my $cookie = $c->plugin('Cookie')->get($arg);

    my $id = ($cookie) ? $cookie : $arg;

    my %session;

    eval {
        tie %session, 'Apache::Session::File', $id, {
            Directory     => "$doc_root/tmp/$arg/session",
            LockDirectory => "$doc_root/tmp/$arg/lock",
          };
      };

    unless ($@) {
        tied(%session)->delete;

        $c->plugin('Cookie')->delete( $c, $arg );
    }

    return;
}

#----------------------------------------------------------------------------+
# update( \%controller, $arg, \%data );
#
# Takes the cookie unique identifier or session id as arguments.  Updates
# existing session data.

lib/Apache2/WebApp/Plugin/Session/File.pm  view on Meta::CPAN

      = validate_pos( @_,
          { type => OBJECT  },
          { type => HASHREF },
          { type => SCALAR  },
          { type => HASHREF }
          );

    $self->error('Malformed session identifier')
      unless ( $arg =~ /^[\w-]{32}$/ );

    my $cookie = $c->plugin('Cookie')->get($arg);

    my $id = ($cookie) ? $cookie : $arg;

    my $doc_root = $c->config->{apache_doc_root};

    my %session;

    eval {
        tie %session, 'Apache::Session::File', $id, {
            Directory     => "$doc_root/tmp/$arg/session",

lib/Apache2/WebApp/Plugin/Session/File.pm  view on Meta::CPAN

    my ( $self, $c, $name )
      = validate_pos( @_,
          { type => OBJECT  },
          { type => HASHREF },
          { type => SCALAR  }
          );

    $self->error('Malformed session identifier')
      unless ( $name =~ /^[\w-]{32}$/ );

    return $c->plugin('Cookie')->get($name);
}

#~~~~~~~~~~~~~~~~~~~~~~~~~~[  PRIVATE METHODS  ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#----------------------------------------------------------------------------+
# _init(\%params)
#
# Return a reference of $self to the caller.

sub _init {

lib/Apache2/WebApp/Plugin/Session/File.pm  view on Meta::CPAN

Store persistent data on the filesystem while maintaining a stateful session
using web browser cookies.

=head1 PREREQUISITES

This package is part of a larger distribution and was NOT intended to be used 
directly.  In order for this plugin to work properly, the following packages
must be installed:

  Apache2::WebApp
  Apache2::WebApp::Plugin::Cookie
  Apache2::WebApp::Plugin::Session
  Apache::Session::File
  Apache::Session::Lock::File
  Params::Validate

=head1 INSTALLATION

From source:

  $ tar xfz Apache2-WebApp-Plugin-Session-File-0.X.X.tar.gz

lib/Apache2/WebApp/Plugin/Session/File.pm  view on Meta::CPAN

  [session]
  storage_type = file
  expires = 1h

=head1 OBJECT METHODS

Please refer to L<Apache2::WebApp::Plugin::Session> for method info.

=head1 SEE ALSO

L<Apache2::WebApp>, L<Apache2::WebApp::Plugin>, L<Apache2::WebApp::Plugin::Cookie>,
L<Apache2::WebApp::Plugin::Session>, L<Apache::Session>, L<Apache::Session::File>,
L<Apache::Session::Lock::File>

=head1 AUTHOR

Marc S. Brooks, E<lt>mbrooks@cpan.orgE<gt> - L<http://mbrooks.info>

=head1 COPYRIGHT

This program is free software; you can redistribute it and/or modify it



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