Scope::Session - a scope based object note and option store
Version 0.02
Scope::Session is a Scope lifetime object store , which can use as a replacement of Apache::Request::Util::pnotes.
use Scope::Session; Scope::Session::start { my $session = shift; $session->notes( $key => $value ); # your great code. # };
get a block and start session
get_instance returns instance of Scope::Session. It is unique in the block called at Scope::Session::start.
use Scope::Session; Scope::Session::start { my $session = Scope::Session->get_instance; };
to set a session unique option value
Scope::Session->set_option( KEY => VALUE )
to get a session unique option value
Scope::Session->get_option( KEY );
Scope::Session->notes( KEY => VALUE );
Scope::Session->notes( KEY );
Scope::Session->notes->set( KEY => VALUE ); Scope::Session->notes->get( KEY ); Scope::Session->notes->exists( KEY );
push error handler
Scope::Session::start { Scope::Session->add_error_handler( 'Error::DB::Refused' ,sub { # log it }); # ... die with Error::DB::Refused; }
if in a scope session, return true value.
Scope::Session::start { Scope::Session->is_started ; # 1 }; Scope::Session->is_started ; # 0
Daichi Hiroki, <hirokidaichi<AT>gmail.com>
<hirokidaichi<AT>gmail.com>
Copyright 2009 Daichi Hiroki.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Scope::Session, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Scope::Session
CPAN shell
perl -MCPAN -e shell install Scope::Session
For more information on module installation, please visit the detailed CPAN module installation guide.