view release on metacpan or search on metacpan
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
$session->auth_servers(
[ new CGI::LDAPSession::LDAPServer(
'ldap.server.my.domain', # host
389, # port
'ou=my,ou=domain', # root
'ou=people,ou=my,ou=domain' # base
'uid=$username,ou=people,ou=my,ou=domain' # bind
) ] );
$session->cookie_table( 'myCookieTable' );
=head2 Performing the Initial Login
my $action = $cgi->param('action');
my $passkey = $cgi->param('passkey');
if ( defined $action and $action eq 'Log In' )
{
my $username = $cgi->param('username');
my $password = $cgi->param('password');
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
There are three columns it expects. The first is the name of the
user; the second is the contents of the cookie; and the third is the
passkey. By default these are called, respectively, 'user_id',
'cookie', and 'cookie', and 'passkey'. You may never need to change
these. If you do need to change them then you would write:
$session->user_column('username');
$session->cookie_column('login_cookie');
$session->passkey_column('login_passkey');
=head2 Setting Cookie Parameters
When your program sends back a cookie, the cookie needs to have several
parameters set. These include the name of the cookie, the path which it
covers, the domain for which it is good, and wether or not it should
be used without a secure connection.
$session->cookie_name( 'MySessionCookie123587098' ); # The name of the cookie
$session->cookie_path( '/' );
$session->cookie_domain( '.drinktomi.com' );
$session->secure( 1 ); # 1=requires secure transport
# 0=does not require secure transport
Most importantly you need describe how long the cookie should be valid
for. This is the expiration. It is given in seconds. If using the
refresh option (more on this later) then the expiration determines how
long the web browser can sit idle. If not using the refresh option
then it determines how long the user will remain logged in.
$session->cookie_expiration( 60*60*2 ); # Cookies will be good for two hours.
=head2 Setting Login Behavior
Setting the auto refresh cookie option to 1 will the cookie's expiration
time to be updated every time a page is sent to the client. As long as
the user keeps using the application they will never be logged out.
$session->auto_refresh_cookie(1) # 1=always refresh the session cookie
# 0=never automatically refresh the session cookie
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
=head2 Changing the Passcode
if ( $session->confirmed( $key ) )
{
$session->set_passcode;
...
Session was confirmed and this is a valid session
...
}
=head2 Changing the Cookie Identifier
if ( $session->confirmed( $key ) )
{
$session->set_login_cookie;
...
Session was confirmed and this is a valid session
...
}
=head2 Refreshing the Cookie Expiration
if ( $session->confirmed( $key ) )
{
$session->refresh_login_cookie;
...
Session was confirmed and this is a valid session
...
}
=head2 Logging Out
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
...
print $session->header() # You must send back a cookie using the $session
print $cgi->start_html( 'Logout Page' );
print "You have been logged out."; # Notice that the passkey does not
# need to be sent back.
print $cgi->end_html;
exit 0;
}
=head2 Creating the Cookie Table
Guess what? Once you have configured your CGIviaLDAP there is a function
which will create the table that you have described. It only works for
MySQL at the moment, but in the future it may work for other databases.
$session->create_cookie_table;
=head1 TO DO
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
$self->cookie_table( $a{'-cookie_table'} ) if defined $a{'-cookie_table'};
$self->user_column( $a{'-user_column'} ) if defined $a{'-user_column'};
$self->passkey_column( $a{'-passkey_column'} ) if defined $a{'-passkey_column'};
$self->cookie_column( $a{'-cookie_column'} ) if defined $a{'-cookie_column'};
$self->dbi_login_expiration_column( $a{'-dbi_login_expiration_column'} ) if defined $a{'-dbi_login_expiration_column'};
$self->passkey_name( $a{-passkey_name} ) if defined $a{-passkey_name};
$self->debug( $a{-debug} ) if defined $a{-debug};
}
# Cookie characteristics.
#
=item Cookie Characteristics
These accessor methods specify the details of the cookies which are generated.
=item CGI::LDAPSession::cookie_logged_in($;$)
Accessor method. The name of the login cookie. Use cookie_name instead.
=cut
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
carp "Passkey is $passkey";
my $client_cookie;
my $db_passkey;
$client_cookie = $self->check_cookie;
if(!defined $client_cookie or !$client_cookie)
{
# No client Cookie!
carp "No Cookie!" if $self->debug;
$self->is_authenticated(undef);
return 0;
}
my $cookie_table = $self->cookie_table;
my $user_column = $self->user_column;
my $cookie_column = $self->cookie_column;
my $passkey_column = $self->passkey_column;
$self->ConnectToDatabase;
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
my $cookie = $cgi->cookie( -name=>$self->cookie_logged_in,
-value=>$cookie_value,
-path=>$self->cookie_path,
-domain=>$self->cookie_domain,
-secure=>($self->cookie_secure ? 1 : 0 ),
-expires=>$datetimestr );
return $cookie;
}
#
# Set the Session Cookie (login)
#
=item CGI::LDAPSession::set_login_cookie($;$)
Sets the login cookie for an authenticated session. If a username
is not specified then it pulls the username corresponding to the
current cookie and passkey combination.
$self->set_login_cookie( $username );
..or..
Session/CVS/Base/LDAPSession.pm view on Meta::CPAN
my ($self) = @_;
my $logout_cookie = $self->logout_cookie;
$self->cookie( $logout_cookie );
# SUCCESS
return 0;
}
#
# Check Cookie
#
=item CGI::LDAPSession::check_cookie($)
Returns the cookie for this session if it exists. If a
cookie does not exist then it returns nothing.
my $login_cookie = $self->check_cookie();
=cut
Session/MANIFEST view on Meta::CPAN
MANIFEST
Makefile.PL
t/01loadsession.t
t/02loadcookiejar.t
t/03loadcookiejardbi.t
t/04loadauthenticators.t
t/05loadauthorizors.t
t/10loadcgi.t
Session.pm
lib/CGI/Session/CGI.pm
lib/CGI/Session/CookieJar.pm
lib/CGI/Session/CookieJar/DBI.pm
lib/CGI/Session/Authenticator/LDAP.pm
lib/CGI/Session/Authenticator/NetLDAP.pm
lib/CGI/Session/Authenticator/Backdoor.pm
lib/CGI/Session/Authorizor/LDAP.pm
lib/CGI/Session/Authorizor/NetLDAP.pm
lib/CGI/Session/Authorizor/Allowed_User_File.pm
bin/CGI/Session/CookieJar/create_cookie_table
Session/Makefile view on Meta::CPAN
lib/CGI/Session/Authorizor/Allowed_User_File.pm.~1~ \
lib/CGI/Session/Authorizor/Allowed_User_File.pm.~2~ \
lib/CGI/Session/Authorizor/Allowed_User_File.pm.~3~ \
lib/CGI/Session/Authorizor/LDAP.pm \
lib/CGI/Session/Authorizor/LDAP.pm.~1~ \
lib/CGI/Session/Authorizor/LDAP.pm.~2~ \
lib/CGI/Session/Authorizor/NetLDAP.pm \
lib/CGI/Session/Authorizor/NetLDAP.pm.~1~ \
lib/CGI/Session/Authorizor/NetLDAP.pm.~2~ \
lib/CGI/Session/CGI.pm \
lib/CGI/Session/CookieJar.pm \
lib/CGI/Session/CookieJar.pm~ \
lib/CGI/Session/CookieJar/DBI.pm \
lib/CGI/Session/CookieJar/DBI.pm~
PM_TO_BLIB = lib/CGI/Session/Authorizor/LDAP.pm.~1~ \
$(INST_LIB)/CGI/Session/Authorizor/LDAP.pm.~1~ \
lib/CGI/Session/Authorizor/LDAP.pm.~2~ \
$(INST_LIB)/CGI/Session/Authorizor/LDAP.pm.~2~ \
lib/CGI/Session/Authorizor/Allowed_User_File.pm.~1~ \
$(INST_LIB)/CGI/Session/Authorizor/Allowed_User_File.pm.~1~ \
lib/CGI/Session/Authenticator/LDAP.pm.~1~ \
$(INST_LIB)/CGI/Session/Authenticator/LDAP.pm.~1~ \
lib/CGI/Session/Authorizor/Allowed_User_File.pm.~2~ \
Session/Makefile view on Meta::CPAN
lib/CGI/Session/Authenticator/NetLDAP.pm.~2~ \
$(INST_LIB)/CGI/Session/Authenticator/NetLDAP.pm.~2~ \
lib/CGI/Session/Authenticator/NetLDAP.pm.~3~ \
$(INST_LIB)/CGI/Session/Authenticator/NetLDAP.pm.~3~ \
lib/CGI/Session/Authenticator/Backdoor.pm \
$(INST_LIB)/CGI/Session/Authenticator/Backdoor.pm \
lib/CGI/Session/Authenticator/NetLDAP.pm \
$(INST_LIB)/CGI/Session/Authenticator/NetLDAP.pm \
lib/CGI/Session/CGI.pm \
$(INST_LIB)/CGI/Session/CGI.pm \
lib/CGI/Session/CookieJar/DBI.pm~ \
$(INST_LIB)/CGI/Session/CookieJar/DBI.pm~ \
lib/CGI/Session/CookieJar.pm~ \
$(INST_LIB)/CGI/Session/CookieJar.pm~ \
lib/CGI/Session/CookieJar/DBI.pm \
$(INST_LIB)/CGI/Session/CookieJar/DBI.pm \
lib/CGI/Session/CookieJar.pm \
$(INST_LIB)/CGI/Session/CookieJar.pm
# --- MakeMaker tool_autosplit section:
# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
# --- MakeMaker tool_xsubpp section:
Session/Makefile view on Meta::CPAN
clean ::
-rm -rf ./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all perlmain.c mon.out core so_locations pm_to_blib *~ */*~ */*/*~ *$(OBJ_EXT) *$(LIB_EXT) perl.exe $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def $(BASEEXT).exp
-mv Makefile Makefile.old $(DEV_NULL)
# --- MakeMaker realclean section:
# Delete temporary files (via clean) and also delete installed files
realclean purge :: clean
rm -rf $(INST_AUTODIR) $(INST_ARCHAUTODIR)
rm -f $(INST_LIB)/CGI/Session/Authorizor/LDAP.pm.~1~ $(INST_LIB)/CGI/Session/Authorizor/LDAP.pm.~2~ $(INST_LIB)/CGI/Session/Authorizor/Allowed_User_File.pm.~1~ $(INST_LIB)/CGI/Session/Authenticator/LDAP.pm.~1~ $(INST_LIB)/CGI/Session/Authorizor/Allo...
rm -rf Makefile Makefile.old
# --- MakeMaker dist_basics section:
distclean :: realclean distcheck
distcheck :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=fullcheck \
-e fullcheck
Session/Session.pm view on Meta::CPAN
=head2 Setting Things Up
use CGI::Session;
use CGI;
my $cgi = new CGI::Session::CGI;
my $session = new CGI::Session( $cgi );
$cgi->session( $session );
my $session_store = new CGI::Session::CookieJar::DBI;
$session_store->set( -cookie_name=>'cookie_name',
-username=>'myuser',
-password=>'kjsdfdf',
-host=>'dbhost',
-database=>'mydb',
-cookie_table=>'cookiejar' );
$session->set( -cookie_jar => $session_store );
$session->auth_servers(
Session/Session.pm view on Meta::CPAN
There are three columns it expects. The first is the name of the
user; the second is the contents of the cookie; and the third is the
passkey. By default these are called, respectively, 'user_id',
'cookie', and 'cookie', and 'passkey'. You may never need to change
these. If you do need to change them then you would write:
$session->user_column('username');
$session->cookie_column('login_cookie');
$session->passkey_column('login_passkey');
=head2 Setting Cookie Parameters
When your program sends back a cookie, the cookie needs to have several
parameters set. These include the name of the cookie, the path which it
covers, the domain for which it is good, and wether or not it should
be used without a secure connection.
$session->cookie_name( 'MySessionCookie123587098' ); # The name of the cookie
$session->cookie_path( '/' );
$session->cookie_domain( '.drinktomi.com' );
$session->secure( 1 ); # 1=requires secure transport
# 0=does not require secure transport
Most importantly you need describe how long the cookie should be valid
for. This is the expiration. It is given in seconds. If using the
refresh option (more on this later) then the expiration determines how
long the web browser can sit idle. If not using the refresh option
then it determines how long the user will remain logged in.
$session->cookie_expiration( 60*60*2 ); # Cookies will be good for two hours.
=head2 Setting Login Behavior
Setting the auto refresh cookie option to 1 will the cookie's expiration
time to be updated every time a page is sent to the client. As long as
the user keeps using the application they will never be logged out.
$session->auto_refresh_cookie(1) # 1=always refresh the session cookie
# 0=never automatically refresh the session cookie
Session/Session.pm view on Meta::CPAN
=head2 Changing the Passcode
if ( $session->confirmed( $key ) )
{
$session->set_passcode;
...
Session was confirmed and this is a valid session
...
}
=head2 Changing the Cookie Identifier
if ( $session->confirmed( $key ) )
{
$session->set_login_cookie;
...
Session was confirmed and this is a valid session
...
}
=head2 Refreshing the Cookie Expiration
if ( $session->confirmed( $key ) )
{
$session->refresh_login_cookie;
...
Session was confirmed and this is a valid session
...
}
=head2 Logging Out
Session/Session.pm view on Meta::CPAN
...
print $session->header() # You must send back a cookie using the $session
print $cgi->start_html( 'Logout Page' );
print "You have been logged out."; # Notice that the passkey does not
# need to be sent back.
print $cgi->end_html;
exit 0;
}
=head2 Creating the Cookie Table
Guess what? Once you have configured your CGIviaLDAP there is a function
which will create the table that you have described. It only works for
MySQL at the moment, but in the future it may work for other databases.
$session->create_cookie_table;
=head1 TO DO
Session/Session.pm view on Meta::CPAN
$self->auth_servers( $a{-auth_servers} ) if defined $a{-auth_servers};
$self->restricted_access( $a{-restricted_access} ) if defined $a{-restricted_access};
$self->allowed_user_file( $a{-allowed_user_file} ) if defined $a{-allowed_user_file};
$self->unikey( $a{-unikey} ) if defined $a{-unikey};
$self->register( $a{-register} ) if defined $a{-register};
$self->auto_refresh_cookie( $a{-auto_refresh_cookie} ) if defined $a{-auto_refresh_cookie};
$self->passkey_name( $a{-passkey_name} ) if defined $a{-passkey_name};
$self->debug( $a{-debug} ) if defined $a{-debug};
}
# Cookie characteristics.
#
=item Cookie Characteristics
These accessor methods specify the details of the cookies which are generated.
=item CGI::Session::cookie_name
Accessor method. The name of the login cookie.
=cut
Session/Session.pm view on Meta::CPAN
Forget about this one. This is an internal function used by CGI::Session and CGI::Session::CGI.
Normally set to zero. Setting CGI::Session::CGI::session causes this value to be set.
=cut
sub used_with_custom_cgi { my $self=shift; @_ ? $self->{used_with_custom_cgi}=shift : $self->{used_with_custom_cgi}; }
=item CGI::Session::cookie_jar
# Cookiejar. This handles all cookie storage.
#
Accessor method. The object encapsulating cookie storage.
=cut
sub cookie_jar { my $self=shift; @_ ? $self->{cookie_jar}=shift : $self->{cookie_jar}; }
Session/Session.pm view on Meta::CPAN
$auth_token->{-groupdn} = $groupdn;
}
my $client_cookie;
my $db_passkey;
$client_cookie = $self->check_cookie;
if(!defined $client_cookie or !$client_cookie)
{
# No client Cookie!
carp "No Cookie!" if $self->debug;
return 0;
}
my $cookie_jar = $self->cookie_jar;
my $session = $cookie_jar->session( -query=>{-cookie_name=>$self->cookie_name,
-cookie=>$client_cookie},
-omit_server_side_data=>1 );
if ( defined $cookie_jar->error )
{
Session/Session.pm view on Meta::CPAN
my $cookie = $cgi->cookie( -name=>$self->cookie_name,
-value=>$cookie_value,
-path=>$self->cookie_path,
-domain=>$self->cookie_domain,
-secure=>($self->cookie_secure ? 1 : 0 ),
-expires=>$datetimestr );
return $cookie;
}
#
# Set the Session Cookie (login)
#
=item CGI::Session::set_login_cookie
Sets the login cookie for an authenticated session. If a username
is not specified then it pulls the username corresponding to the
current cookie and passkey combination.
$self->set_login_cookie( $username );
..or..
Session/Session.pm view on Meta::CPAN
my ($self) = @_;
my $logout_cookie = $self->logout_cookie;
$self->cookie( $logout_cookie );
# SUCCESS
return 0;
}
#
# Check Cookie
#
=item CGI::Session::check_cookie
Returns the cookie for this session if it exists. If a
cookie does not exist then it returns nothing.
my $login_cookie = $self->check_cookie();
=cut
Session/bin/CGI/Session/CookieJar/create_cookie_table view on Meta::CPAN
#!/usr/local/bin/perl5
#
use strict;
package CGI::Session::CookieJar::DBI::creakte_cookie_table;
use Carp;
use Getopt::Long;
use DBI;
use CGI::Session::CookieJar::DBI;
my $DB_MYSQL = 'MYSQL';
=item NAME
create_cookie_table. A tool to create a cookie jar for use with a cookie.
It will create a database if required. If the desired table exists
with a preexisting database then it will drop the table and then
recreate it. It will also create a grant for the cookie user if it is
Session/bin/CGI/Session/CookieJar/create_cookie_table view on Meta::CPAN
print "\n";
}
}
else
{
$grantpass = $pass;
}
my $jar = CGI::Session::CookieJar::DBI->new();
$dbtype = $DB_MYSQL unless defined $dbtype;
if ( uc($dbtype ) eq $DB_MYSQL )
{
$dbtype=$DB_MYSQL;
}
else
{
die_help();
}
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
=head2 Setting Things Up
use CGI::Session;
use CGI;
my $cgi = new CGI::Session::CGI;
my $session = new CGI::Session( $cgi );
$cgi->session( $session );
my $session_store = new CGI::Session::CookieJar::DBI;
$session_store->set( -cookie_name=>'cookie_name',
-username=>'myuser',
-password=>'kjsdfdf',
-host=>'dbhost',
-database=>'mydb',
-cookie_table=>'cookiejar' );
$session->set( -cookie_jar => $session_store );
$session->auth_servers(
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
There are three columns it expects. The first is the name of the
user; the second is the contents of the cookie; and the third is the
passkey. By default these are called, respectively, 'user_id',
'cookie', and 'cookie', and 'passkey'. You may never need to change
these. If you do need to change them then you would write:
$session->user_column('username');
$session->cookie_column('login_cookie');
$session->passkey_column('login_passkey');
=head2 Setting Cookie Parameters
When your program sends back a cookie, the cookie needs to have several
parameters set. These include the name of the cookie, the path which it
covers, the domain for which it is good, and wether or not it should
be used without a secure connection.
$session->cookie_name( 'MySessionCookie123587098' ); # The name of the cookie
$session->cookie_path( '/' );
$session->cookie_domain( '.drinktomi.com' );
$session->secure( 1 ); # 1=requires secure transport
# 0=does not require secure transport
Most importantly you need describe how long the cookie should be valid
for. This is the expiration. It is given in seconds. If using the
refresh option (more on this later) then the expiration determines how
long the web browser can sit idle. If not using the refresh option
then it determines how long the user will remain logged in.
$session->cookie_expiration( 60*60*2 ); # Cookies will be good for two hours.
=head2 Setting Login Behavior
Setting the auto refresh cookie option to 1 will the cookie's expiration
time to be updated every time a page is sent to the client. As long as
the user keeps using the application they will never be logged out.
$session->auto_refresh_cookie(1) # 1=always refresh the session cookie
# 0=never automatically refresh the session cookie
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
=head2 Changing the Passcode
if ( $session->confirmed( $key ) )
{
$session->set_passcode;
...
Session was confirmed and this is a valid session
...
}
=head2 Changing the Cookie Identifier
if ( $session->confirmed( $key ) )
{
$session->set_login_cookie;
...
Session was confirmed and this is a valid session
...
}
=head2 Refreshing the Cookie Expiration
if ( $session->confirmed( $key ) )
{
$session->refresh_login_cookie;
...
Session was confirmed and this is a valid session
...
}
=head2 Logging Out
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
...
print $session->header() # You must send back a cookie using the $session
print $cgi->start_html( 'Logout Page' );
print "You have been logged out."; # Notice that the passkey does not
# need to be sent back.
print $cgi->end_html;
exit 0;
}
=head2 Creating the Cookie Table
Guess what? Once you have configured your CGIviaLDAP there is a function
which will create the table that you have described. It only works for
MySQL at the moment, but in the future it may work for other databases.
$session->create_cookie_table;
=head1 TO DO
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
$self->auth_servers( $a{-auth_servers} ) if defined $a{-auth_servers};
$self->restricted_access( $a{-restricted_access} ) if defined $a{-restricted_access};
$self->allowed_user_file( $a{-allowed_user_file} ) if defined $a{-allowed_user_file};
$self->unikey( $a{-unikey} ) if defined $a{-unikey};
$self->register( $a{-register} ) if defined $a{-register};
$self->auto_refresh_cookie( $a{-auto_refresh_cookie} ) if defined $a{-auto_refresh_cookie};
$self->passkey_name( $a{-passkey_name} ) if defined $a{-passkey_name};
$self->debug( $a{-debug} ) if defined $a{-debug};
}
# Cookie characteristics.
#
=item Cookie Characteristics
These accessor methods specify the details of the cookies which are generated.
=item CGI::Session::cookie_name
Accessor method. The name of the login cookie.
=cut
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
Forget about this one. This is an internal function used by CGI::Session and CGI::Session::CGI.
Normally set to zero. Setting CGI::Session::CGI::session causes this value to be set.
=cut
sub used_with_custom_cgi { my $self=shift; @_ ? $self->{used_with_custom_cgi}=shift : $self->{used_with_custom_cgi}; }
=item CGI::Session::cookie_jar
# Cookiejar. This handles all cookie storage.
#
Accessor method. The object encapsulating cookie storage.
=cut
sub cookie_jar { my $self=shift; @_ ? $self->{cookie_jar}=shift : $self->{cookie_jar}; }
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
$auth_token->{-groupdn} = $groupdn;
}
my $client_cookie;
my $db_passkey;
$client_cookie = $self->check_cookie;
if(!defined $client_cookie or !$client_cookie)
{
# No client Cookie!
carp "No Cookie!" if $self->debug;
return 0;
}
my $cookie_jar = $self->cookie_jar;
my $session = $cookie_jar->session( -query=>{-cookie_name=>$self->cookie_name,
-cookie=>$client_cookie},
-omit_server_side_data=>1 );
if ( defined $cookie_jar->error )
{
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
my $cookie = $cgi->cookie( -name=>$self->cookie_name,
-value=>$cookie_value,
-path=>$self->cookie_path,
-domain=>$self->cookie_domain,
-secure=>($self->cookie_secure ? 1 : 0 ),
-expires=>$datetimestr );
return $cookie;
}
#
# Set the Session Cookie (login)
#
=item CGI::Session::set_login_cookie
Sets the login cookie for an authenticated session. If a username
is not specified then it pulls the username corresponding to the
current cookie and passkey combination.
$self->set_login_cookie( $username );
..or..
Session/blib/lib/CGI/Session.pm view on Meta::CPAN
my ($self) = @_;
my $logout_cookie = $self->logout_cookie;
$self->cookie( $logout_cookie );
# SUCCESS
return 0;
}
#
# Check Cookie
#
=item CGI::Session::check_cookie
Returns the cookie for this session if it exists. If a
cookie does not exist then it returns nothing.
my $login_cookie = $self->check_cookie();
=cut
Session/blib/lib/CGI/Session/CookieJar.pm view on Meta::CPAN
#!/usr/local/bin/perl5
#
package CGI::Session::CookieJar;
use Carp;
=item CGI::Session::CookieJar
An abstract data store for cookies.
The general usage is as follows:
my $cookiejar;
$cookiejar = new CGI::Session::CookieJar::YOUR_JAR_HERE( PARAMETERS );
$cookiejar->open();
...
... cookie operations
...
$cookiejar->close();
Most functions manipulating cookies use "queries" to specify the
cookies which will be operated upon. These queries are references to
associative arrays. The keys indicate variables which will be
Session/blib/lib/CGI/Session/CookieJar.pm view on Meta::CPAN
of "435765"
{ user => "bob", passkey => "6578" } selects all cookies which have the user
"bob" and the passkey set to "6578"
There is no way to select a union of search results.
=cut
=item CGI::Session::CookieJar::open
$cookiejar->open();
Opens up the cookie jar. This must be called before any operations
can take place. When you are through with the cookie jar the close
operation me be called.
=cut
sub open { my $p=__PACKAGE__; croak "The $p::open operation must be defined."; }
=item CGI::Session::CookieJar::close
$cookiejar->close;
Closes a previously opened cookie jar. This must be done before your program ends.
=cut
sub close { my $p = __PACKAGE__; croak "The method $p::close must be defined."; }
=item CGI::Session::CookieJar::contains
Determines if a session contains a given cookie.
my $time = time;
my %query = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'>$time' );
my $has_cookie = $cookie_jar->contains( -query => \$query );
=cut
sub contains { my $p=__PACKAGE__; croak "$p::contains is not implemented, but it must be."; };
=item CGI::Session::CookieJar::cookie
Retreives a cookie from the cookie jar using a specified query. If no
cookie is found then it returns 'undef'.
By default all cookie fields are returned as an array of hashes . If
your application potentially contains large 'server_side_data' fields
this may not be what you want. In this case cases you can specify
that the server_side_data field will not be returned by setting the
-omit_server_side_data option to a true value.
Session/blib/lib/CGI/Session/CookieJar.pm view on Meta::CPAN
my @sessions = $cookie_jar->session( -query => \%query,
-omit_server_side_data=>1 );
=cut
sub session { my $p=__PACKAGE__; croak "$p::session is not implemented, but it must be."; };
=item CGI::Session::CookieJar::delete
Deletes the specified cookies from the cookie jar.
my $time = time;
my %query = ( expiration=>'<$time' );
$cookie_jar->delete( -query => \$query );
=cut
sub delete { my $p=__PACKAGE__; croak "$p::delete is not implemented, but it must be."; };
=item CGI::Session::CookieJar::set_session
Sets the session variables for a previously created user entry. The
user entry must already exist. If it does not exist then it must
be created with CGI::Session::CookieJar::register_user.
The 'user' field is required for the c
my $time = time;
my %session = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'$time',
server_data=>$data );
my $cookie_jar->set_session( -session => \%session );
=cut
sub set_session { my $p=__PACKAGE__; croak "$p::set_session is not implemented, but it must be."; };
=item CGI::Session::CookieJar::register_user
Creates an entry for the specified user within the cookie jar. Attempting
to register a user which does not exist will result in an error.
if ( ! $cookie_jar->contains( -user=>$username ) )
{
$cookie_jar->register_user( $username );
}
=cut
=item CGI::Session::CookieJar::version
Returns the version of CGI::Session that was used to create this
data store.
my $version => $cookie_jar->version();
=cut
sub version { my $p=__PACKAGE__; croak "$p::version is not implemented, but it must be."; };
=item CGI::Session::CookieJar::create_cookie_jar
Creates a new cookie jar. For a database cookie jar this would create
the necessary tables. For a file based cookie jar this might set up
the required directory structure.
This should only be necessary once.
$cookie_jar->create_cookie_jar();
=cut
sub create_cookie_jar { my $p=__PACKAGE__; croak "$p::create_cookie_jar is not implemented, but it must be."; };
=item CGI::Session::CookieJar::destroy_cookie_jar
Destroys an existing cookie jar. For a database cookie jar this would
drop all of the tables. For a file based cookie jar this might
delete all the existing files and directories.
This should only be necessary once.
$cookie_jar->destroy_cookie_jar();
=cut
sub destroy_cookie_jar { my $p=__PACKAGE__; croak "$p::destroy_cookie_jar is not implemented, but it must be."; };
=item CGI::Session::CookieJar::error
If the previous cookie operation resulted in an error then
the value of this error will be found here. If the operation
did not result in an error then this will return 'undef'.
Calling error() does not alter the value. Each cookie jar object has
it's own error state, which is independent of the backend database.
my $error = $cookie_jar->error();
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
#!/usr/local/bin/perl5
#
package CGI::Session::CookieJar::DBI;
use Carp;
use Time::Local;
use CGI::Session::CookieJar;
use vars qw( @ISA );
push @ISA, qw( CGI::Session::CookieJar );
# Mechanisms for managing databases.
#
my $DB_MYSQL='DB_MYSQL';
sub db_type { _param( shift, '-db_type', @_ ); }
sub use_mysql { shift->db_type( $DB_MYSQL ); }
sub db { _param( shift, '-db', @_ ); }
my $I_USER = 'user';
my $I_COOKIE = 'cookie';
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
-passkey_column => 'passkey',
-login_expiration_column => 'expiration',
-server_side_data_column => 'data',
-host => 'localhost', );
$self->set(@_) if @_;
return $self;
}
=name CGI::Session::CookieJar::DBI
A DBI Based CookieJar.
The general usage is as follows:
my $cookiejar;
$cookiejar = new CGI::Session::CookieJar::DBI();
$cookiejar->use_mysql();
$cookiejar->user( 'MyMYSQLUser' );
$cookiejar->password( 'lijlkdfsf' );
$cookiejar->database( 'DBI' );
$cookiejar->host( 'my.dbi.server.myco.com' );
$cookiejar->open();
...
... cookie operations
...
$cookiejar->close();
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
{ user => "bob", passkey => "6578" } selects all cookies which have the user
"bob" and the passkey set to "6578"
There is no way to select a union of search results.
=cut
=item CGI::Session::CookieJar::DBI::open
$cookiejar->open();
Opens up the cookie jar. This must be called before any operations
can take place. When you are through with the cookie jar the close
operation must be called.
=cut
sub open
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
return;
}
$self->db( $db );
}
else
{
$self->error( "Could not determine the type of database that should be connected to." );
}
}
=item CGI::Session::CookieJar::DBI::close
$cookiejar->close;
Closes a previously opened cookie jar. This must be done before your program ends.
=cut
sub close
{
my $self=shift;
$self->error( undef );
return unless defined $self->db();
$self->db->disconnect;
$self->db( undef );
}
=item CGI::Session::CookieJar::DBI::contains
Determines if a session contains a given cookie.
my $time = time;
my %query = ( -user=>'bob',
-cookie_name=>'sdfljkjj48jf',
-cookie=>'3476dfgh',
-passkey=>'23438',
-expiration=>'>$time' );
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
$statement->finish;
return;
}
my @count = $statement->fetchrow_array();
my $matches = $count[0];
$statement->finish;
return $matches != 0;
}
=item CGI::Session::CookieJar::DBI::cookie
Retreives a cookie from the cookie jar using a specified query. If no
cookie is found then it returns 'undef'.
By default all cookie fields are returned. If your application potentially
contains large 'server_data' fields this may not be what you want. In these
cases you can specify a list of fields to omit. These fields are passed in
via array reference.
my $time = time;
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
$session->{$I_PASSKEY} = $row->{$passkey_column} if defined $row->{$passkey_column};
$session->{$I_EXPIRATION} = $self->timestamp_to_time($row->{$login_expiration_column}) if defined $row->{$login_expiration_column};
$session->{$I_SERVER_SIDE_DATA} = $row->{$server_side_data_column} if defined $row->{$server_side_data_column};
push @results, $session;
}
$statement->finish;
return \@results;
}
=item CGI::Session::CookieJar::DBI::delete
Deletes the specified cookies from the cookie jar.
my $time = time;
my %query = ( -expiration=>'<$time' );
$cookie_jar->delete( %query );
=cut
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
return unless $self->has_valid_connection;
$self->error(undef);
my $query = $self->build_where_query( @_ );
my $db = $self->db;
$db->do( "DELETE FROM $db->cookie_table WHERE $query" );
$self->db_error( "Database error while attempting to delete from ".($db->cookie_table).": %s" );
}
=item CGI::Session::CookieJar::DBI::set_session
Creates a new session
my $time = time;
my %session = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'$time',
server_side_data=>$data );
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
my $db = $self->db;
if ( defined $db and $db->err )
{
my $error = ($db->err).', '.($db->errstr);
$self->error( sprintf( $msg, $error ) );
return 1;
}
return 0;
}
=item CGI::Session::CookieJar::DBI::register_user
Creates an entry for the specified user within the cookie table.
if ( ! $self->contains( -cookie_name=>$cookie_name, -user=>$username ) )
{
$self->register_user( $cookie_name, $username );
}
=cut
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
$db->quote($username) ) );
return if $self->db_error( "Encountered error while attempting to create $username entry for the cookie name $cookie in $cookie_table: DBI Error: %s" );
if ( $self->db_type eq $DB_MYSQL and $rows != 0 )
{
$self->error( "SQL statement should have created exactly one line, but $rows seem to have been created." );
}
}
=item CGI::Session::CookieJar::DBI::version
Returns the version of CGI::Session that was used to create this
data store.
my $version => $cookie_jar->version();
=cut
sub version { return "0.0001"; }
=item CGI::Session::CookieJar::DBI::destroy_cookie_jar
Destroys an existing cookie jar. For a database cookie jar this would
drop all of the tables. For a file based cookie jar this might
delete all the existing files and directories.
This should only be necessary once.
$cookie_jar->destroy_cookie_jar();
=cut
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
my ($self) = @_;
my $cookie_table = $self->cookie_table;
my $db = $self->db();
$db->do( "DROP TABLE $cookie_table" );
}
=item CGI::Session::CookieJar::DBI::error
If the previous cookie operation resulted in an error then
the value of this error will be found here. If the operation
did not result in an error then this will return 'undef'.
Calling error() does not alter the value. Each cookie jar object has
it's own error state, which is independent of the backend database.
my $error = $cookie_jar->error();
Session/blib/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
croak "Programmer Error: $field is not a known parameter" unless defined $slot;
$self->{$slot} = shift;
}
}
}
sub set { _param(shift,@_); }
# Login/cookie table description.
#
=item CGI::Session::CookieJar::DBI::host
Accessor method. The name of the host.
=cut
sub host { _param( shift, '-host', @_ ); }
=item CGI::Session::CookieJar::DBI::user
Accessor method. The name of the user.
=cut
sub user { _param( shift, '-user', @_ ); }
=item CGI::Session::CookieJar::DBI::password
Accessor method. The name of the password.
=cut
sub password { _param( shift, '-password', @_ ); }
=item CGI::Session::CookieJar::DBI::database
Accessor method. The name of the database.
=cut
sub database { _param( shift, '-database', @_ ); }
=item Database tables
The names of the database tables.
=item CGI::Session::CookieJar::DBI::cookie_table
Accessor method. The name of the cookie table.
=cut
sub cookie_table { _param( shift, '-cookie_table', @_ ); }
=item CGI::Session::CookieJar::DBI::user_column
Accessor method. The column containing the usernames.
=cut
sub user_column { _param( shift, '-user_column', @_ ); }
=item CGI::Session::CookieJar::DBI::passkey_column
Accessor method. The column containing the passkey.
=cut
sub passkey_column { _param( shift, '-passkey_column', @_ ); }
=item CGI::Session::CookieJar::DBI::cookie_name_column
Accessor method. The column containing the name of the cookie.
=cut
sub cookie_name_column { _param( shift, '-cookie_name_column', @_ ); }
=item CGI::Session::CookieJar::DBI::cookie_column
Accessor method. The column containing the cookie value.
=cut
sub cookie_column { _param( shift, '-cookie_column', @_ ); }
=item CGI::Session::CookieJar::DBI::login_expiration_column
Accessor method. The expiration time for the cookie. Currently not
used, but it will be used in the future.
=cut
sub login_expiration_column { _param( shift, '-login_expiration_column', @_ ); }
=item CGI::Session::CookieJar::DBI::server_side_data_column
Accessor method. The name of the column containing server side data.
=cut
sub server_side_data_column { _param( shift, '-server_side_data_column', @_ ); }
=item CGI::Session::CookieJar::DBI::create_cookie_jar
Creates the database tables that are described by a CGI::Session.
my $session = new CGI::Session;
$session->create_cookie_jar;
exit;
Fill out your CGI::Session just like your going to make
a connection. Call this routine, and voila! Your database
tables are created.
Session/blib/man3/CGI::Session.3 view on Meta::CPAN
.Sh "Setting Things Up"
use \s-1CGI::\s0Session;
use \s-1CGI\s0;
.PP
.Vb 3
\& my $cgi = new CGI::Session::CGI;
\& my $session = new CGI::Session( $cgi );
\& $cgi->session( $session );
.Ve
.Vb 8
\& my $session_store = new CGI::Session::CookieJar::DBI;
\& $session_store->set( -cookie_name=>'cookie_name',
\& -username=>'myuser',
\& -password=>'kjsdfdf',
\& -host=>'dbhost',
\& -database=>'mydb',
\& -cookie_table=>'cookiejar' );
\& $session->set( -cookie_jar => $session_store );
.Ve
.Vb 8
\& $session->auth_servers(
Session/blib/man3/CGI::Session.3 view on Meta::CPAN
user; the second is the contents of the cookie; and the third is the
passkey. By default these are called, respectively, \*(L'user_id\*(R',
\&'cookie\*(R', and \*(L'cookie\*(R', and \*(L'passkey\*(R'. You may never need to change
these. If you do need to change them then you would write:
.PP
.Vb 3
\& $session->user_column('username');
\& $session->cookie_column('login_cookie');
\& $session->passkey_column('login_passkey');
.Ve
.Sh "Setting Cookie Parameters"
When your program sends back a cookie, the cookie needs to have several
parameters set. These include the name of the cookie, the path which it
covers, the domain for which it is good, and wether or not it should
be used without a secure connection.
.PP
.Vb 5
\& $session->cookie_name( 'MySessionCookie123587098' ); # The name of the cookie
\& $session->cookie_path( '/' );
\& $session->cookie_domain( '.drinktomi.com' );
\& $session->secure( 1 ); # 1=requires secure transport
\& # 0=does not require secure transport
.Ve
Most importantly you need describe how long the cookie should be valid
for. This is the expiration. It is given in seconds. If using the
refresh option (more on this later) then the expiration determines how
long the web browser can sit idle. If not using the refresh option
then it determines how long the user will remain logged in.
.PP
.Vb 1
\& $session->cookie_expiration( 60*60*2 ); # Cookies will be good for two hours.
.Ve
.Sh "Setting Login Behavior"
Setting the auto refresh cookie option to 1 will the cookie's expiration
time to be updated every time a page is sent to the client. As long as
the user keeps using the application they will never be logged out.
.PP
.Vb 2
\& $session->auto_refresh_cookie(1) # 1=always refresh the session cookie
\& # 0=never automatically refresh the session cookie
.Ve
Session/blib/man3/CGI::Session.3 view on Meta::CPAN
.PP
.Vb 7
\& if ( $session->confirmed( $key ) )
\& {
\& $session->set_passcode;
\& ...
\& Session was confirmed and this is a valid session
\& ...
\& }
.Ve
.Sh "Changing the Cookie Identifier"
.PP
.Vb 7
\& if ( $session->confirmed( $key ) )
\& {
\& $session->set_login_cookie;
\& ...
\& Session was confirmed and this is a valid session
\& ...
\& }
.Ve
.Sh "Refreshing the Cookie Expiration"
.PP
.Vb 7
\& if ( $session->confirmed( $key ) )
\& {
\& $session->refresh_login_cookie;
\& ...
\& Session was confirmed and this is a valid session
\& ...
\& }
.Ve
Session/blib/man3/CGI::Session.3 view on Meta::CPAN
\& $session->set_logout_cookie;
\& ...
\& print $session->header() # You must send back a cookie using the $session
\& print $cgi->start_html( 'Logout Page' );
\& print "You have been logged out."; # Notice that the passkey does not
\& # need to be sent back.
\& print $cgi->end_html;
\& exit 0;
\& }
.Ve
.Sh "Creating the Cookie Table"
Guess what? Once you have configured your CGIviaLDAP there is a function
which will create the table that you have described. It only works for
MySQL at the moment, but in the future it may work for other databases.
.PP
.Vb 1
\& $session->create_cookie_table;
.Ve
.SH "TO DO"
.Ip "1. Provide function to retreive username from the database using the cookie." 4
.Ip "2. Provide support for Net::\s-1LDAP\s0" 4
Session/blib/man3/CGI::Session.3 view on Meta::CPAN
successfully authenticated.
.Ip "\s-1CGI::\s0Session::auto_refresh_cookie" 4
Accessor method. Normally the cookie will expire X seconds after it is created, where X is
specified by \s-1CGI::\s0Session::cookie_expiration. Whenever the cookie is refreshed this
timer resets. Setting this variable to a non-zero value causes the cookie to be refreshed
every time that it is successfully verified.
.Ip "\s-1CGI::\s0Session::used_with_custom_cgi" 4
Forget about this one. This is an internal function used by \s-1CGI::\s0Session and \s-1CGI::\s0Session::\s-1CGI\s0.
Normally set to zero. Setting \s-1CGI::\s0Session::\s-1CGI::\s0session causes this value to be set.
.Ip "\s-1CGI::\s0Session::cookie_jar" 4
# Cookiejar. This handles all cookie storage.
#
Accessor method. The object encapsulating cookie storage.
.Ip "\s-1CGI::\s0Session::passkey_name" 4
Accessor method. The name of the passkey field in the form is stored here.
Not currently important, but it will be if/when the table becomes a shared
resource.
.Ip "\s-1CGI::\s0Session::debug" 4
Accessor method. Turns on debugging. Currently this doesn't do much. I need
to add more instrumentation.
.Ip "\s-1CGI::\s0Session::has_passkey" 4
Session/blib/man3/CGI::Session.3 view on Meta::CPAN
.IX Header "USAGE"
.IX Subsection "Setting up the Authentication Object"
.IX Subsection "Setting the Authentication Servers"
.IX Subsection "Describing the Database Connection"
.IX Subsection "Describing the Database Table"
.IX Subsection "Setting Cookie Parameters"
.IX Subsection "Setting Login Behavior"
.IX Subsection "Sending Back a Page"
.IX Subsection "Authenticating a New Session"
.IX Subsection "Confirming an Existing Session"
.IX Subsection "Changing the Passcode"
.IX Subsection "Changing the Cookie Identifier"
.IX Subsection "Refreshing the Cookie Expiration"
.IX Subsection "Logging Out"
.IX Subsection "Creating the Cookie Table"
.IX Header "TO DO"
.IX Item "1. Provide function to retreive username from the database using the cookie."
.IX Item "2. Provide support for Net::\s-1LDAP\s0"
.IX Item "3. Clean up \s-1DBI\s0 code. (\s-1DBI\s0 provides the independence that the old routines did.)"
.IX Item "4. Clean up \s-1DBI\s0 connection creation. (Makes way too many database connections.)"
Session/lib/CGI/Session/CookieJar.pm view on Meta::CPAN
#!/usr/local/bin/perl5
#
package CGI::Session::CookieJar;
use Carp;
=item CGI::Session::CookieJar
An abstract data store for cookies.
The general usage is as follows:
my $cookiejar;
$cookiejar = new CGI::Session::CookieJar::YOUR_JAR_HERE( PARAMETERS );
$cookiejar->open();
...
... cookie operations
...
$cookiejar->close();
Most functions manipulating cookies use "queries" to specify the
cookies which will be operated upon. These queries are references to
associative arrays. The keys indicate variables which will be
Session/lib/CGI/Session/CookieJar.pm view on Meta::CPAN
of "435765"
{ user => "bob", passkey => "6578" } selects all cookies which have the user
"bob" and the passkey set to "6578"
There is no way to select a union of search results.
=cut
=item CGI::Session::CookieJar::open
$cookiejar->open();
Opens up the cookie jar. This must be called before any operations
can take place. When you are through with the cookie jar the close
operation me be called.
=cut
sub open { my $p=__PACKAGE__; croak "The $p::open operation must be defined."; }
=item CGI::Session::CookieJar::close
$cookiejar->close;
Closes a previously opened cookie jar. This must be done before your program ends.
=cut
sub close { my $p = __PACKAGE__; croak "The method $p::close must be defined."; }
=item CGI::Session::CookieJar::contains
Determines if a session contains a given cookie.
my $time = time;
my %query = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'>$time' );
my $has_cookie = $cookie_jar->contains( -query => \$query );
=cut
sub contains { my $p=__PACKAGE__; croak "$p::contains is not implemented, but it must be."; };
=item CGI::Session::CookieJar::cookie
Retreives a cookie from the cookie jar using a specified query. If no
cookie is found then it returns 'undef'.
By default all cookie fields are returned as an array of hashes . If
your application potentially contains large 'server_side_data' fields
this may not be what you want. In this case cases you can specify
that the server_side_data field will not be returned by setting the
-omit_server_side_data option to a true value.
Session/lib/CGI/Session/CookieJar.pm view on Meta::CPAN
my @sessions = $cookie_jar->session( -query => \%query,
-omit_server_side_data=>1 );
=cut
sub session { my $p=__PACKAGE__; croak "$p::session is not implemented, but it must be."; };
=item CGI::Session::CookieJar::delete
Deletes the specified cookies from the cookie jar.
my $time = time;
my %query = ( expiration=>'<$time' );
$cookie_jar->delete( -query => \$query );
=cut
sub delete { my $p=__PACKAGE__; croak "$p::delete is not implemented, but it must be."; };
=item CGI::Session::CookieJar::set_session
Sets the session variables for a previously created user entry. The
user entry must already exist. If it does not exist then it must
be created with CGI::Session::CookieJar::register_user.
The 'user' field is required for the c
my $time = time;
my %session = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'$time',
server_data=>$data );
my $cookie_jar->set_session( -session => \%session );
=cut
sub set_session { my $p=__PACKAGE__; croak "$p::set_session is not implemented, but it must be."; };
=item CGI::Session::CookieJar::register_user
Creates an entry for the specified user within the cookie jar. Attempting
to register a user which does not exist will result in an error.
if ( ! $cookie_jar->contains( -user=>$username ) )
{
$cookie_jar->register_user( $username );
}
=cut
=item CGI::Session::CookieJar::version
Returns the version of CGI::Session that was used to create this
data store.
my $version => $cookie_jar->version();
=cut
sub version { my $p=__PACKAGE__; croak "$p::version is not implemented, but it must be."; };
=item CGI::Session::CookieJar::create_cookie_jar
Creates a new cookie jar. For a database cookie jar this would create
the necessary tables. For a file based cookie jar this might set up
the required directory structure.
This should only be necessary once.
$cookie_jar->create_cookie_jar();
=cut
sub create_cookie_jar { my $p=__PACKAGE__; croak "$p::create_cookie_jar is not implemented, but it must be."; };
=item CGI::Session::CookieJar::destroy_cookie_jar
Destroys an existing cookie jar. For a database cookie jar this would
drop all of the tables. For a file based cookie jar this might
delete all the existing files and directories.
This should only be necessary once.
$cookie_jar->destroy_cookie_jar();
=cut
sub destroy_cookie_jar { my $p=__PACKAGE__; croak "$p::destroy_cookie_jar is not implemented, but it must be."; };
=item CGI::Session::CookieJar::error
If the previous cookie operation resulted in an error then
the value of this error will be found here. If the operation
did not result in an error then this will return 'undef'.
Calling error() does not alter the value. Each cookie jar object has
it's own error state, which is independent of the backend database.
my $error = $cookie_jar->error();
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
#!/usr/local/bin/perl5
#
package CGI::Session::CookieJar::DBI;
use Carp;
use Time::Local;
use CGI::Session::CookieJar;
use vars qw( @ISA );
push @ISA, qw( CGI::Session::CookieJar );
# Mechanisms for managing databases.
#
my $DB_MYSQL='DB_MYSQL';
sub db_type { _param( shift, '-db_type', @_ ); }
sub use_mysql { shift->db_type( $DB_MYSQL ); }
sub db { _param( shift, '-db', @_ ); }
my $I_USER = 'user';
my $I_COOKIE = 'cookie';
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
-passkey_column => 'passkey',
-login_expiration_column => 'expiration',
-server_side_data_column => 'data',
-host => 'localhost', );
$self->set(@_) if @_;
return $self;
}
=name CGI::Session::CookieJar::DBI
A DBI Based CookieJar.
The general usage is as follows:
my $cookiejar;
$cookiejar = new CGI::Session::CookieJar::DBI();
$cookiejar->use_mysql();
$cookiejar->user( 'MyMYSQLUser' );
$cookiejar->password( 'lijlkdfsf' );
$cookiejar->database( 'DBI' );
$cookiejar->host( 'my.dbi.server.myco.com' );
$cookiejar->open();
...
... cookie operations
...
$cookiejar->close();
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
{ user => "bob", passkey => "6578" } selects all cookies which have the user
"bob" and the passkey set to "6578"
There is no way to select a union of search results.
=cut
=item CGI::Session::CookieJar::DBI::open
$cookiejar->open();
Opens up the cookie jar. This must be called before any operations
can take place. When you are through with the cookie jar the close
operation must be called.
=cut
sub open
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
return;
}
$self->db( $db );
}
else
{
$self->error( "Could not determine the type of database that should be connected to." );
}
}
=item CGI::Session::CookieJar::DBI::close
$cookiejar->close;
Closes a previously opened cookie jar. This must be done before your program ends.
=cut
sub close
{
my $self=shift;
$self->error( undef );
return unless defined $self->db();
$self->db->disconnect;
$self->db( undef );
}
=item CGI::Session::CookieJar::DBI::contains
Determines if a session contains a given cookie.
my $time = time;
my %query = ( -user=>'bob',
-cookie_name=>'sdfljkjj48jf',
-cookie=>'3476dfgh',
-passkey=>'23438',
-expiration=>'>$time' );
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
$statement->finish;
return;
}
my @count = $statement->fetchrow_array();
my $matches = $count[0];
$statement->finish;
return $matches != 0;
}
=item CGI::Session::CookieJar::DBI::cookie
Retreives a cookie from the cookie jar using a specified query. If no
cookie is found then it returns 'undef'.
By default all cookie fields are returned. If your application potentially
contains large 'server_data' fields this may not be what you want. In these
cases you can specify a list of fields to omit. These fields are passed in
via array reference.
my $time = time;
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
$session->{$I_PASSKEY} = $row->{$passkey_column} if defined $row->{$passkey_column};
$session->{$I_EXPIRATION} = $self->timestamp_to_time($row->{$login_expiration_column}) if defined $row->{$login_expiration_column};
$session->{$I_SERVER_SIDE_DATA} = $row->{$server_side_data_column} if defined $row->{$server_side_data_column};
push @results, $session;
}
$statement->finish;
return \@results;
}
=item CGI::Session::CookieJar::DBI::delete
Deletes the specified cookies from the cookie jar.
my $time = time;
my %query = ( -expiration=>'<$time' );
$cookie_jar->delete( %query );
=cut
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
return unless $self->has_valid_connection;
$self->error(undef);
my $query = $self->build_where_query( @_ );
my $db = $self->db;
$db->do( "DELETE FROM $db->cookie_table WHERE $query" );
$self->db_error( "Database error while attempting to delete from ".($db->cookie_table).": %s" );
}
=item CGI::Session::CookieJar::DBI::set_session
Creates a new session
my $time = time;
my %session = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'$time',
server_side_data=>$data );
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
my $db = $self->db;
if ( defined $db and $db->err )
{
my $error = ($db->err).', '.($db->errstr);
$self->error( sprintf( $msg, $error ) );
return 1;
}
return 0;
}
=item CGI::Session::CookieJar::DBI::register_user
Creates an entry for the specified user within the cookie table.
if ( ! $self->contains( -cookie_name=>$cookie_name, -user=>$username ) )
{
$self->register_user( $cookie_name, $username );
}
=cut
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
$db->quote($username) ) );
return if $self->db_error( "Encountered error while attempting to create $username entry for the cookie name $cookie in $cookie_table: DBI Error: %s" );
if ( $self->db_type eq $DB_MYSQL and $rows != 0 )
{
$self->error( "SQL statement should have created exactly one line, but $rows seem to have been created." );
}
}
=item CGI::Session::CookieJar::DBI::version
Returns the version of CGI::Session that was used to create this
data store.
my $version => $cookie_jar->version();
=cut
sub version { return "0.0001"; }
=item CGI::Session::CookieJar::DBI::destroy_cookie_jar
Destroys an existing cookie jar. For a database cookie jar this would
drop all of the tables. For a file based cookie jar this might
delete all the existing files and directories.
This should only be necessary once.
$cookie_jar->destroy_cookie_jar();
=cut
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
my ($self) = @_;
my $cookie_table = $self->cookie_table;
my $db = $self->db();
$db->do( "DROP TABLE $cookie_table" );
}
=item CGI::Session::CookieJar::DBI::error
If the previous cookie operation resulted in an error then
the value of this error will be found here. If the operation
did not result in an error then this will return 'undef'.
Calling error() does not alter the value. Each cookie jar object has
it's own error state, which is independent of the backend database.
my $error = $cookie_jar->error();
Session/lib/CGI/Session/CookieJar/DBI.pm view on Meta::CPAN
croak "Programmer Error: $field is not a known parameter" unless defined $slot;
$self->{$slot} = shift;
}
}
}
sub set { _param(shift,@_); }
# Login/cookie table description.
#
=item CGI::Session::CookieJar::DBI::host
Accessor method. The name of the host.
=cut
sub host { _param( shift, '-host', @_ ); }
=item CGI::Session::CookieJar::DBI::user
Accessor method. The name of the user.
=cut
sub user { _param( shift, '-user', @_ ); }
=item CGI::Session::CookieJar::DBI::password
Accessor method. The name of the password.
=cut
sub password { _param( shift, '-password', @_ ); }
=item CGI::Session::CookieJar::DBI::database
Accessor method. The name of the database.
=cut
sub database { _param( shift, '-database', @_ ); }
=item Database tables
The names of the database tables.
=item CGI::Session::CookieJar::DBI::cookie_table
Accessor method. The name of the cookie table.
=cut
sub cookie_table { _param( shift, '-cookie_table', @_ ); }
=item CGI::Session::CookieJar::DBI::user_column
Accessor method. The column containing the usernames.
=cut
sub user_column { _param( shift, '-user_column', @_ ); }
=item CGI::Session::CookieJar::DBI::passkey_column
Accessor method. The column containing the passkey.
=cut
sub passkey_column { _param( shift, '-passkey_column', @_ ); }
=item CGI::Session::CookieJar::DBI::cookie_name_column
Accessor method. The column containing the name of the cookie.
=cut
sub cookie_name_column { _param( shift, '-cookie_name_column', @_ ); }
=item CGI::Session::CookieJar::DBI::cookie_column
Accessor method. The column containing the cookie value.
=cut
sub cookie_column { _param( shift, '-cookie_column', @_ ); }
=item CGI::Session::CookieJar::DBI::login_expiration_column
Accessor method. The expiration time for the cookie. Currently not
used, but it will be used in the future.
=cut
sub login_expiration_column { _param( shift, '-login_expiration_column', @_ ); }
=item CGI::Session::CookieJar::DBI::server_side_data_column
Accessor method. The name of the column containing server side data.
=cut
sub server_side_data_column { _param( shift, '-server_side_data_column', @_ ); }
=item CGI::Session::CookieJar::DBI::create_cookie_jar
Creates the database tables that are described by a CGI::Session.
my $session = new CGI::Session;
$session->create_cookie_jar;
exit;
Fill out your CGI::Session just like your going to make
a connection. Call this routine, and voila! Your database
tables are created.
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
#!/usr/local/bin/perl5
#
package CGI::LDAPSession::CookieJar::DBI;
use Carp;
use Time::Local;
use CGI::LDAPSession::CookieJar;
use vars qw( @ISA );
push @ISA, qw( CGI::LDAPSession::CookieJar );
# Mechanisms for managing databases.
#
my $DB_MYSQL='DB_MYSQL';
sub db_type { _param( shift, '-db_type', @_ ); }
sub use_mysql { shift->db_type( $DB_MYSQL ); }
my $I_USER = 'user';
my $I_COOKIE = 'cookie';
my $I_EXPIRATION = 'expiration';
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
-cookie_column => 'cookie',
-passkey_column => 'passkey',
-login_expiration_column => 'expiration',
-server_side_data_column => 'data',
-host => 'localhost', );
$self->set(@_) if @_;
return $self;
}
=item CGI::LDAPSession::CookieJar::DBI
A DBI Based CookieJar.
The general usage is as follows:
my $cookiejar;
$cookiejar = new CGI::LDAPSession::CookieJar::DBI();
$cookiejar->use_mysql();
$cookiejar->user( 'MyMYSQLUser' );
$cookiejar->password( 'lijlkdfsf' );
$cookiejar->database( 'DBI' );
$cookiejar->host( 'my.dbi.server.myco.com' );
$cookiejar->open();
...
... cookie operations
...
$cookiejar->close();
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
{ user => "bob", passkey => "6578" } selects all cookies which have the user
"bob" and the passkey set to "6578"
There is no way to select a union of search results.
=cut
=item CGI::LDAPSession::CookieJar::DBI::open
$cookiejar->open();
Opens up the cookie jar. This must be called before any operations
can take place. When you are through with the cookie jar the close
operation me be called.
=cut
sub open
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
}
}
else
{
$self->error( "Could not determine the type of database that should be connected to." );
}
}
=item CGI::LDAPSession::CookieJar::DBI::close
$cookiejar->close;
Closes a previously opened cookie jar. This must be done before your program ends.
=cut
sub close
{
my $self=shift;
$self->error( undef );
return unless defined $self->db();
$self->db->disconnect;
$self->db( undef );
}
=item CGI::LDAPSession::CookieJar::DBI::contains
Determines if a session contains a given cookie.
my $time = time;
my %query = ( -user=>'bob',
-cookie=>'3476dfgh',
-passkey=>'23438',
-expiration=>'>$time' );
my $has_cookie = $cookie_jar->contains( -query => \$query );
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
$statement->finish;
return;
}
my @count = $statement->fetchrow_array();
my $matches = $count[0];
$statement->finish;
return $matches != 0;
}
=item CGI::LDAPSession::CookieJar::DBI::cookie
Retreives a cookie from the cookie jar using a specified query. If no
cookie is found then it returns 'undef'.
By default all cookie fields are returned. If your application potentially
contains large 'server_data' fields this may not be what you want. In these
cases you can specify a list of fields to omit. These fields are passed in
via array reference.
my $time = time;
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
$session->{$I_PASSKEY} = $row->{$passkey_column} if defined $row->{$passkey_column};
$session->{$I_EXPIRATION} = $self->timestamp_to_time($row->{$login_expiration_column}) if defined $row->{$login_expiration_column};
$session->{$I_SERVER_SIDE_DATA} = $row->{$server_side_data_column} if defined $row->{$server_side_data_column);
push @results, $session;
}
$statement->finish;
return \@results;
}
=item CGI::LDAPSession::CookieJar::DBI::delete
Deletes the specified cookies from the cookie jar.
my $time = time;
my %query = ( expiration=>'<$time' );
$cookie_jar->delete( %query );
=cut
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
$db->do( "DELETE FROM $db->cookie_table WHERE $query" );
if ( $db->err )
{
$self->error( "Database error while attempting to delete from $db->cookie_table: $db->err, $db->errstr" );
return;
}
}
=item CGI::LDAPSession::CookieJar::DBI::set_session
Creates a new session
my $time = time;
my %session = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'$time',
server_side_data=>$data );
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
return sprintf( "%.4d%.2d%.2d%.2d%.2d%.2d", $year, $mon, $day, $hour, $min, $sec );
}
sub timestamp_to_time
{
my ( $self, $timestamp ) = @_;
$timestamp =~ /(\d\d\d\d)(\d\d){5}/;
return timegm( $6, $5, $4, $3, $2, $1 );
}
=item CGI::LDAPSession::CookieJar::DBI::register_user
Creates an entry for the specified user within the cookie table.
if ( ! $self->contains( -user=>$username ) )
{
$self->register_user( $username );
}
=cut
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
return;
}
if ( $self->db_type eq $DB_MYSQL and $rows != 0 )
{
$self->error( "SQL statement should have created exactly one line, but $rows seem to have been created." );
}
}
=item CGI::LDAPSession::CookieJar::DBI::version
Returns the version of CGI::LDAPSession that was used to create this
data store.
my $version => $cookie_jar->version();
=cut
sub version { return "0.0001"; }
=item CGI::LDAPSession::CookieJar::DBI::create_cookie_jar
Creates a new cookie jar. For a database cookie jar this would create
the necessary tables. For a file based cookie jar this might set up
the required directory structure.
This should only be necessary once.
$cookie_jar->create_cookie_jar();
=cut
sub create_cookie_jar { my $p=__PACKAGE__; croak "$p::create_cookie_jar is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::DBI::destroy_cookie_jar
Destroys an existing cookie jar. For a database cookie jar this would
drop all of the tables. For a file based cookie jar this might
delete all the existing files and directories.
This should only be necessary once.
$cookie_jar->destroy_cookie_jar();
=cut
sub destroy_cookie_jar { my $p=__PACKAGE__; croak "$p::destroy_cookie_jar is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::DBI::error
If the previous cookie operation resulted in an error then
the value of this error will be found here. If the operation
did not result in an error then this will return 'undef'.
Calling error() does not alter the value. Each cookie jar object has
it's own error state, which is independent of the backend database.
my $error = $cookie_jar->error();
Session/libpres/CGI/LDAPSession/CookieJar/DBI.pm view on Meta::CPAN
croak "Programmer Error: $field is not a known parameter" unless defined $slot;
$self->{$slot} = shift;
}
}
}
sub set { _param(shift,@_); }
# Login/cookie table description.
#
=item CGI::LDAPSession::CookieJar::DBI::database
Accessor method. The name of the database.
=cut
sub database { _param( shift, '-database', @_ ); }
=item Database tables
The names of the database tables.
=item CGI::LDAPSession::CookieJar::DBI::cookie_table
Accessor method. The name of the cookie table.
=cut
sub cookie_table { _param( shift, '-cookie_table', @_ ); }
=item CGI::LDAPSession::CookieJar::DBI::user_column
Accessor method. The column containing the usernames.
=cut
sub user_column { _param( shift, '-user_column', @_ ); }
=item CGI::LDAPSession::CookieJar::DBI::passkey_column
Accessor method. The column containing the passkey.
=cut
sub passkey_column { _param( shift, '-passkey_column', @_ ); }
=item CGI::LDAPSession::CookieJar::DBI::cookie_column
Accessor method. The column containing the cookie id.
=cut
sub cookie_column { _param( shift, '-cookie_column', @_ ); }
=item CGI::LDAPSession::CookieJar::DBI::login_expiration_column
Accessor method. The expiration time for the cookie. Currently not
used, but it will be used in the future.
=cut
sub login_expiration_column { _param( shift, '-login_expiration_column', @_ ); }
=item CGI::LDAPSession::CookieJar::DBI::server_side_data_column
Accessor method. The name of the column containing server side data.
=cut
sub server_side_data_column { _param( shift, '-server_side_data_column', @_ ); }
=item CGI::LDAPSession::CookieJar::DBI::create_cookie_jar
Creates the database tables that are described by a CGI::LDAPSession.
my $session = new CGI::LDAPSession;
$session->create_cookie_table;
exit;
Fill out your CGI::LDAPSession just like your going to make
a connection. Call this routine, and voila! Your database
tables are created.
Session/libpres/CGI/LDAPSession/CookieJar/create_cookie_table view on Meta::CPAN
#!/usr/local/bin/perl5
#
package CGI::LDAPSession::CookieJar::DBI;
use Carp;
use CGI::LDAPSession::CookieJar::DBI;
use vars qw( @ISA );
push @ISA, qw( CGI::LDAPSession::CookieJar );
=item CGI::LDAPSession::CookieJar::DBI
A DBI Based CookieJar.
The general usage is as follows:
my $cookiejar;
$cookiejar = new CGI::LDAPSession::CookieJar::DBI();
$cookiejar->use_mysql();
$cookiejar->user( 'MyMYSQLUser' );
$cookiejar->password( 'lijlkdfsf' );
$cookiejar->database( 'DBI' );
$cookiejar->host( 'my.dbi.server.myco.com' );
$cookiejar->open();
...
... cookie operations
...
$cookiejar->close();
Session/libpres/CGI/LDAPSession/CookieJar/create_cookie_table view on Meta::CPAN
of "435765"
{ user => "bob", passkey => "6578" } selects all cookies which have the user
"bob" and the passkey set to "6578"
There is no way to select a union of search results.
=cut
=item CGI::LDAPSession::CookieJar::open
$cookiejar->open();
Opens up the cookie jar. This must be called before any operations
can take place. When you are through with the cookie jar the close
operation me be called.
=cut
sub open { my $p=__PACKAGE__; $croak "The $p::open operation must be defined."; }
=item CGI::LDAPSession::CookieJar::close
$cookiejar->close;
Closes a previously opened cookie jar. This must be done before your program ends.
=cut
sub close { my $p = __PACKAGE__; croak "The method $p::close must be defined."; }
=item CGI::LDAPSession::CookieJar::contains
Determines if a session contains a given cookie.
my $time = time;
my %query = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'>$time' );
my $has_cookie = $cookie_jar->contains( -query => \$query );
=cut
sub contains { my $p=__PACKAGE__; croak "$p::contains is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::cookie
Retreives a cookie from the cookie jar using a specified query. If no
cookie is found then it returns 'undef'.
By default all cookie fields are returned. If your application potentially
contains large 'server_data' fields this may not be what you want. In these
cases you can specify a list of fields to omit. These fields are passed in
via array reference.
my $time = time;
Session/libpres/CGI/LDAPSession/CookieJar/create_cookie_table view on Meta::CPAN
my $cookie = $cookie_jar->cookie( -query => \$query,
-omit => [ "server_data" ] );
=cut
sub cookie { my $p=__PACKAGE__; croak "$p::cookie is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::delete
Deletes the specified cookies from the cookie jar.
my $time = time;
my %query = ( expiration=>'<$time' );
$cookie_jar->cookie( -query => \$query );
=cut
sub delete { my $p=__PACKAGE__; croak "$p::delete is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::create_cookie
Creates a new cookie
my $time = time;
my %cookie = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'$time',
server_data=>$data );
my $cookie_jar->create_cookie( -cookie => \$cookie );
=cut
sub create_cookie { my $p=__PACKAGE__; croak "$p::create_cookie is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::modify_cookie
Modifies the specified cookie fields in all the matching cookies.
my $time = time;
my %query = ( user=>'bob',
cookie_name=>'3476dfgh',
passkey=>'23438',
expiration=>'>$time' );
my %changed_fields = ( server_data=>$data,
expiration=>($time+3600) );
Session/libpres/CGI/LDAPSession/CookieJar/create_cookie_table view on Meta::CPAN
return unless $self->connection_valid();
my $db = $self->dbi;
my $results = $dbi->do( "INSERT INTO $cookie_table ( $user_column ) VALUES ( '$username' )" );
if ( $
$self->DisconnectDatabase;
}
=item CGI::LDAPSession::CookieJar::version
Returns the version of CGI::LDAPSession that was used to create this
data store.
my $version => $cookie_jar->version();
=cut
sub version { my $p=__PACKAGE__; croak "$p::version is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::create_cookie_jar
Creates a new cookie jar. For a database cookie jar this would create
the necessary tables. For a file based cookie jar this might set up
the required directory structure.
This should only be necessary once.
$cookie_jar->create_cookie_jar();
=cut
sub create_cookie_jar { my $p=__PACKAGE__; croak "$p::create_cookie_jar is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::destroy_cookie_jar
Destroys an existing cookie jar. For a database cookie jar this would
drop all of the tables. For a file based cookie jar this might
delete all the existing files and directories.
This should only be necessary once.
$cookie_jar->destroy_cookie_jar();
=cut
sub destroy_cookie_jar { my $p=__PACKAGE__; croak "$p::destroy_cookie_jar is not implemented, but it must be."; };
=item CGI::LDAPSession::CookieJar::error
If the previous cookie operation resulted in an error then
the value of this error will be found here. If the operation
did not result in an error then this will return 'undef'.
Calling error() does not alter the value. Each cookie jar object has
it's own error state, which is independent of the backend database.
my $error = $cookie_jar->error();
Session/t/02loadcookiejar.t view on Meta::CPAN
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
######################### We start with some black magic to print on failure.
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use CGI::Session::CookieJar;
$loaded = 1;
print "ok 1\n";
######################### End of black magic.
# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):
Session/t/03loadcookiejardbi.t view on Meta::CPAN
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
######################### We start with some black magic to print on failure.
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use CGI::Session::CookieJar::DBI;
$loaded = 1;
print "ok 1\n";
######################### End of black magic.
# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):