NAME
CGI::Session::Auth::Mouse::DBI - CGI::Session::Auth::Mouse のSessionの保存先をDBIでうんぬんします
VERSION
This document describes CGI::Session::Auth::Mouse::DBI version 0.0.1
SYNOPSIS
use CGI;
use CGI::Session;
use CGI::Session::Auth::Mouse::DBI;
my $cgi = new CGI;
my $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'});
my $auth = CGI::Session::Auth::Mouse::DBI->new(
cgi => $cgi,
session => $session,
dsn => 'DBI:mysql:cgiauth:localhost:3306',
);
$auth->authenticate();
if ( $auth->logged_in ) {
## show secret page
}
else {
## show login page
}
SAMPLE HTML
<form method="POST" action="sample.cgi">
<input type="text" name="login_username" />
<input type="password" name="login_password" />
<input type="submit" value="submit" />
</form>
DEFAULT TABLE
CREATE TABLE auth_user (
id int(11) NOT NULL,
username varchar(255) NOT NULL,
passward varchar(255) NOT NULL default '',
-- md5_hex value
PRIMARY KEY (id),
UNIQUE username (username)
);
Constructor parameters
Additional to the standard parameters used by the new
constructor of all CGI::Session::Auth::Mouse::Role classes, CGI::Session::Auth::Mouse::DBI understands the following parameters:
- db_handle: Active database handle.
- dsn: Data source name for the database connection. (Default: none) For an explanation, see the DBI documentation.
- db_user: Name of the user account used for the database connection. (Default: none)
- db_password: Password of the user account used for the database connection. (Default: none)
- db_port: Connection Port of the user account used for the database connection. (Default: 3306)
- db_attr: Optional attributes used for the database connection. (Default: none)
- user_table: Name of the table containing the user authentication data and profile. (Default: 'users')
- user_name_field: Name of the column username field. (Default: 'username')
- user_pass_field: Name of the column password field. (Default: 'password')
METHODS
- login
-
CGI::Session::Auth::Mouse::Role requires this method.
- load_profile
-
CGI::Session::Auth::Mouse::Role requires this method.
BUGS AND LIMITATIONS
Please report any bugs or feature requests to bug-cgi-session-auth-mouse-role@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
DEPENDENCIES
CGI::Session::Auth::Mouse::Role DBI Digest::MD5
SEE ALSO
CGI::Session::Auth::DBI CGI::Session::Auth::Mouse::Role DBI
AUTHOR
<noblejasper> <<nobjas@gmail.com>>
LICENCE AND COPYRIGHT
Copyright (c) 2009, <noblejasper> <<nobjas@gmail.com>>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.