Authen...le::DBI(3pm)
π Authen::Simple::DBI β the perl manual page, but make it make sense β¨
okay bestie, so this is Authen::Simple::DBI, a lil module from the User Contributed Perl Documentation situation π
. It does DBI authentication β like, it checks a username and password against your database. Simple! Iconic! Let's go π«Ά
πΈ NAME πΈ
Authen::Simple::DBI β Simple DBI authentication π
β¨ SYNOPSIS β¨
here's the vibe, in Perl:
use Authen::Simple::DBI;
my $dbi = Authen::Simple::DBI->new(
dsn => 'dbi:SQLite:dbname=database.db',
statement => 'SELECT password FROM users WHERE username = ?'
);
if ( $dbi->authenticate( $username, $password ) ) {
# successfull authentication
}
(yes, successfull with two L's β that's what the original says and I am NOT touching it, we respect the source π)
and if you're doing the mod_perl Authen handler thing, it's giving config file energy:
PerlModule Apache::DBI
PerlModule Authen::Simple::Apache
PerlModule Authen::Simple::DBI
PerlSetVar AuthenSimpleDBI_dsn "dbi:SQLite:dbname=database.db"
PerlSetVar AuthenSimpleDBI_statement "SELECT password FROM users WHERE username = ?"
<Location /protected>
PerlAuthenHandler Authen::Simple::DBI
AuthType Basic
AuthName "Protected Area"
Require valid-user
</Location>
π¦ DESCRIPTION π¦
DBI authentication. that's it, that's the description. short queen behavior π
π METHODS π
newβ the constructor, the main character entrance π«§
It takes a hash of parameters. These options are valid, no cap:
dsnβ Database Source Name. Required. like, you cannot skip this one, fr fr.
dsn => 'dbi:SQLite:dbname=database.db'
dsn => 'dbi:mysql:database=database;host=localhost;'
statementβ SQL statement. It must take a single string argument (the username) and return a single value (the password). Required. one in, one out, that's the whole deal β¨
statement => 'SELECT password FROM users WHERE username = ?'
usernameβ the database username π
username => 'username'
passwordβ the database password π€«
password => 'secret'
logβ any object that supports"debug","info","error"and"warn". yes, all four, she's needy but she's worth it π
log => Log::Log4perl->get_logger('Authen::Simple::DBI')
authenticate( $username, $password )β returns true on success and false on failure. boom. that's the whole plot π
π SEE ALSO π
Authen::Simple.Authen::Simple::Password.DBI.
go read those too, they're part of the friend group π«Ά
π AUTHOR π
Christian Hansen ch@ngmedia.com β thank you for your service, legend π
π COPYRIGHT π
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. slay, open source queen π
okay that's the whole page bestie!! πΈ this was perl v5.34.0, dated 2022-06-08, and you just read the whole thing like a champ. mwah, go authenticate something responsibly π β¨
π¦ where this page comes from
- debian bookworm: libauthen-simple-dbi-perl 0.2-4
- debian trixie: libauthen-simple-dbi-perl 0.2-4
- ubuntu noble: libauthen-simple-dbi-perl 0.2-4
- ubuntu resolute: libauthen-simple-dbi-perl 0.2-4
- ubuntu stonking: libauthen-simple-dbi-perl 0.2-4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms