Giter VIP home page Giter VIP logo

catalyst-plugin-session-psgi's Introduction

NAME

Catalyst::Plugin::Session::PSGI - minimal configuration access to PSGI/Plack session (EXPERIMENTAL)

VERSION

version 0.0.2

SYNOPSIS

When running under PSG/Plack with Session middeware enabled you can use the PSGI session as follows:

use Catalyst qw/
    Session
    Session::State::PSGI
    Session::Store::PSGI
/;

_psgi_env

Fetches the psgi env globally from the request env

EXPERIMENTAL

This distribution should be considered experimental. Although functional, it may break in currently undiscovered use cases.

SUMMARY

If you are running your Catalyst application in a Plack/PSGI environment and using Plack::Middleware::Session you might want to consider using the session information in the PSGI environment.

The Catalyst::Plugin::Session::State::PSGI and Catalyst::Plugin::Session::Store::PSGI modules access the psgix.session.options and psgix.session data to provide the Catalyst session.

AREAS OF CONCERN

As this is an early, experimental release I thought it only fair to share the glaring areas of concern:

  • session expiry

    I currently believe that it should be the responsibility of the Plack middleware to expire and clear session data. As far as possible this functionality is unimplemented and unsupported in this distribution.

  • session expiry value initialisation

    There was a problem with the session expiry value being unset in the Catalyst related code. This led to sessions always being deleted/expired and never working properly.

    There are a couple of dubious areas to resolve this.

      sub get_session_data {
          # ...
    
          # TODO: work out correct place to initialise this
          $psgi_env->{'psgix.session.expires'}
              ||= $c->get_session_expires;
    
          # ...
      }
    

    is almost certainly the wrong time and place to be initialising this value, but it works and I'm open to clue-sticks and patches.

      sub get_session_expires {
          my $c = shift;
          my $expires = $c->_session_plugin_config->{expires} || 0;
          return time() + $expires;
      }
    

    worries me because I have no idea where the value for $c->_session_plugin_config->{expires} is being initialised. I'm concerned that this may become 0 when you least expect it and start expiring all sessions.

  • (lack of) test coverage

    Other than basic sanity tests provided by Dist::Zilla this distribution has no tests!

    I haven't found the time to mock up a plack-catalyst test suite to ensure the session is doing the right thing. Once again I'm open to clue-sticks and patches.

SEE ALSO

Catalyst, Catalyst::Plugin::Session, Plack::Middleware::Session, Catalyst::Plugin::Session::State::PSGI, Catalyst::Plugin::Session::Store::PSGI

AUTHOR

Chisel [email protected]

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Chisel Wright.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

catalyst-plugin-session-psgi's People

Contributors

chizmw avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.