Baldrick::FileSession
From CunningPlans
[edit] package Baldrick::FileSession
Baldrick::FileSession is a subclass of Baldrick::Session. This class stores session information in text files, one per session, and rewrites those files at the conclusion of each request.
Ordinarly, one does not instantiate a FileSession directly, instead letting the Baldrick::App create it based on directives in the configuration file.
As well as providing applications with a place to store data between requests, the Session object is required in order to support user login.
- ISA Baldrick::Session, Baldrick::Turnip
- Subclasses: none
[edit] Usage
In the configuration file baldrick.cfg:
<SessionManager default>
type = file
# directory = directory where session manager will dump session files.
directory = /tmp/sessions
</SessionManager>
In your Baldrick::Dogsbody subclass:
my $ssn = $self->getSession();
my $cartitems = $ssn->get("cartitems");
$ssn->put("fred", 123);
Only scalar values may be stored in a session - it is an error to call put() with a reference as the value.
[edit] Interface
Baldrick::FileSession has no public interface except that which is provided by its base classes, Baldrick::Session and Baldrick::Turnip. The most commonly used functions are:
- get(key)
- put(key, value)
- getID()
