Thomas Wittek > Konstrukt > Konstrukt::Session

Download:
konstrukt/Konstrukt-0.5-beta13.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

Konstrukt::Session - Session management (Cookies/Session)

SYNOPSIS ^

The user will automatically get a session and you (as a plugin developer) can access the session object easily like this:

        $Konstrukt::Session->method();

The following methods are available:

        $Konstrukt::Session->activated();             #returns true if the session management is activated
        $sid = $Konstrukt::Session->session_id($key); #get session id
        $Konstrukt::Session->set($key => $value);       #set value
        $boolean = $Konstrukt::Session->exists($key); #does this key exist?
        $value = $Konstrukt::Session->get($key);      #get value
        @keys = $Konstrukt::Session->keys();          #get all keys
        $Konstrukt::Session->delete($key);            #delete specified key
        $Konstrukt::Session->clear();                 #clear all keys

That's currently exactly what the CPAN-module Session offers, since Session currently is the only method of handling sessions internally. As Session uses Apache::Session and Apache::Session::Flex internally, you might also want to take a look at those.

Currently only the MySQL backend has been tested so the settings may not be apropriate to cover all backends offered by Apache::Session.

DESCRIPTION ^

This module provides easy session management for your plugins/websites.

CONFIGURATION ^

To use the session management it must be activated in your konstrukt.settings (it's deactivated by default).

        #Session management
        session/use           1 #default: 0
        #backend module. probably all Apache::Session backends possible, but not tested
        session/store         MySQL
        #dbi source. will default to your Konstrukt::DBI settings, when not specified
        session/source        dbi:mysql:database:host
        session/user          user
        session/pass          pass
        session/timeout       60      #default: delete sessions that haven't been used for 60 minutes
        #session/table        session #currently unsupported
        #only for backend store "File". Note: The path does _not_ relate to your document root!
        session/directory     /tmp/sessions #default: save sessions in dir /tmp/sessions. you have to create that dir!
        #only for backend store "DB_file". Note: The path does _not_ relate to your document root!
        session/file          /tmp/sessions #default: save sessions in file /tmp/sessions
        #show error message, if session could not be loaded or silently create a new one
        session/show_error    1

METHODS ^

new

Constructor of this class

init

Initialization of this class

Parameters: none

install

Initializes the backend according the settings (e.g. create tables).

Parameters:

none

activated

Returns true if the session management is activated and ready to use.

create_session

Creates a new session and sets an SID-cookie

Parameters:

none

set_session

Sets a timestamp for the session and sets it as an attribute of this object

Parameters:

session_cleanup

Deletes old sessions from the database

Parameters:

none

session wrapper methods

Wrapper methods for the usual methods of the session backend. For more indormation take a look at e.g. Session.

(Implemented using AUTOLOAD.)

Methods

AUTHOR ^

Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.

This document is free software. It is distributed under the same terms as Perl itself.

SEE ALSO ^

Session, Apache::Session, Apache::Session::Flex, Konstrukt

syntax highlighting: