Baldrick::Session

From CunningPlans

Jump to: navigation, search

Contents

[edit] package Baldrick::Session

Baldrick::Session is an abstract class that defines the interface for storing and retrieving user session data. Its behaviour is controlled by the SessionManager section of baldrick.cfg.

The Session class provides a mechanism for storing information relevant to a particular user request, and retrieving it on subsequent requests by the same user.

This class usually encountered in the form of its descendant class Baldrick::FileSession.

[edit] Interface

[edit] new()

sub new() 
inherited from Baldrick::Turnip. Calls init() immediately with same args.
sub init(%args) 
called from constructor (Baldrick::Turnip::new), or by factory method if constructors not in use.
  • required parameters:
  • optional parameters:
    • variable => 'name' (default: 'session') -- name of cookie or request parameter to try to get session id from.
    • request => Baldrick::Request
sub DESTROY() 
not intended to be called directly, but will act as finish() if finish() wasn't called yet.
sub finish # ()
calls upon _write() to write any changes to session data back out to the data store (file, database, ...). finish() is generally called by Baldrick::Dogsbody::endRun()

sub DESTROY sub getID # () return session ID sub getContents # () return hashref sub get # ($k) return associated value or if undef. sub del # ($key) sub clear sub put # ($key, $value) sub getHeader # () return string sub allocate # () return string-sessionid

sub debug # ($msg) sub createCaptcha sub getCaptchaPath sub checkCaptcha # return 1 on success, 0 on err, negative on fail

sub _initCaptcha sub _initSession # () sub _getHashRefCGI # (\%parms) return \% sub _getBrowserClaimedSID # ( %parms )

[edit] History

The Session and Baldrick::FileSession objects are among the oldest pieces of the Baldrick Application Framework, based on work I did in C++ the mid 1990s, and intended to be backwards compatible (in terms of both interface and storage mechanism) with those older session managers.

Personal tools