My Perl Libs


NAME

     EL::session - Perl API abstration to WEB session programing


SYNOPSIS

     use EL::session;
     my $ses = EL::session->new(
                 {
                     data_dir => '/var/tmp/sessions',
                     lock_dir => '/var/lock/sessions',
                 });


DESCRIPTION

     Create WEB  sessions, very  useful in WEB  aplications that  need to
 preserve  data (parameters)  between http  requests. The  parameters are
 store  in  a  file  in  the  server side.  Client  side  does  not  need
 to  have  cookies  resources.  For  default, data  files  are  store  in
 '/var/tmp/sessions' and lock files in '/var/lock/sessions'.

METHODS

     $ses->create($expires)
     Create session with expires `$expires' time.
     
     
     $sid = $ses->sid
     Get session identification of the session.
     OBS: Session  identification  needs  to be  preserved  between  http
          requests in the  usual way (GET or POST). However,  can be used
          the lib  EL::cgi (url method)  to embeded sid  automatically in
          URLs. It's very cool and I recomend!
     
     
     $ses->open($sid)
     Open session identify by `$sid'.
     
     
     $ses->set($param,$value) or $ses->set(%params)
     Store parameters in session data file.
     
     
     $ses->unset($param)
     Clean parameters of the session data file.
     
     
     $ses->get($param)
     Get parameter store in session data file.
     
     
     $ses->expires
     Get expires time set in create method.
     
     
     $ses->delete
     Destroy session, by removing data and lock file.


EXAMPLE

     use strict;
     use EL::session;
     use EL::cgi;
     my $cgi = EL::cgi->new;
     my $ses = EL::session->new;
     if ($cgi->('SID')) {
         $ses->open($cgi->('SID'));
     }
     else {
         $ses->create(60*30);
     }
     
     # Embeded parameter `SID=<sid>' in URLs (its cool!!)
     $cgi->url(SID=>$ses->sid);


AUTHORS

     Ednardo Lobo <ednardo@elobo.cjb.net>

SEE ALSO

     EL::lib, Apache::Session