Ambrosia
view release on metacpan or search on metacpan
lib/Ambrosia/Addons/Session.pm view on Meta::CPAN
package Ambrosia::Addons::Session;
use strict;
use warnings;
use Ambrosia::core::Nil;
use Ambrosia::Meta;
class sealed {
extends => [qw/Exporter/],
public => [qw/storage/],
};
our @EXPORT = qw/session/;
our $VERSION = 0.010;
{
our $__SESSION__;
sub new : Private
{
return shift->SUPER::new(@_);
}
sub instance
{
return $__SESSION__ ||= @_ ? shift()->new(@_) : new Ambrosia::core::Nil;
}
sub destroy
{
undef $__SESSION__;
}
sub session
{
return instance __PACKAGE__;
}
}
sub getSessionName
{
return $_[0]->storage->getSessionName();
}
sub getSessionValue
{
return $_[0]->storage->getSessionValue();
}
sub addItem
{
return shift()->storage->addItem(@_);
}
sub getItem
{
return $_[0]->storage->getItem($_[1]);
}
sub deleteItem
{
return $_[0]->storage->deleteItem($_[1]);
}
sub hasSessionData
{
return $_[0]->storage->hasData();
}
1;
__END__
=head1 NAME
Ambrosia::Addons::Session -
=head1 VERSION
version 0.010
( run in 0.891 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )