Test::...Handle(3pm)
π Test::...Handle(3pm) π
okay bestie, welcome to Test::Database::Handle β this one lives in the User Contributed Perl Documentation section of the manual, and it's genuinely one of the chillest little classes you'll ever meet. no cap.
β¨ NAME β¨
Test::Database::Handle β a class for Test::Database handles π
πΈ SYNOPSIS πΈ
use Test::Database;
my $handle = Test::Database->handle(@requests);
my $dbh = $handle->dbh();
likeβ¦ that's it. that's the whole vibe. you ask for a handle, you get a handle, you get a dbh. slay. π
π¦ DESCRIPTION π¦
Test::Database::Handle is a very simple class whose whole job is encapsulating the information about a test database handle. she's not doing too much. she's just holding your stuff. queen behavior honestly.
so here's the deal: inside a test script, Test::Database::Handle objects are the way you get the info you need about a test database handle. and where do the handles come from, you ask? you grab them through the Test::Database->handles() method or the Test::Database->handle() method. those are the plug. πβ¨
π₯ METHODS π₯
Test::Database::Handle provides the following methods, bestie, and there aren't many, so no stress:
π§ new π§
Return a new Test::Database::Handle with the given parameters: dsn, username, password.
the only mandatory argument is dsn. everything else can justβ¦ not exist. she's low maintenance like that. π
π ACCESSORS π
the following accessors are available. come get y'all info:
π dsn
Return the Data Source Name. that's the whole thing. that's the tea. π«
π username
Return the connection username. defaults to undef.
π password
Return the connection password. defaults to undef.
π connection_info
Return the connection information triplet β that's dsn, username, password, all together, as a little squad:
my ( $dsn, $username, $password ) = $handle->connection_info;
look at them. iconic trio. β¨
π dbh
my $dbh = $handle->dbh;
my $dbh = $handle->dbh( $attr );
Return the DBI database handle you get when connecting with the connection triplet returned by connection_info(). yes, that triplet. the iconic one.
the optional parameter $attr is a reference to a hash of connection attributes, and it gets passed directly to DBI's connect() method. no middleman, no filter. straight through. periodt. π
πΈ name
Return the database name attached to the handle.
β dbd
Return the DBI driver name, as computed from the dsn.
π driver
Return the Test::Database::Driver object attached to the handle. she comes with a plus-one. π
π AUTHOR π
Philippe Bruhat (BooK), "<book@cpan.org>"
π COPYRIGHT π
Copyright 2008-2010 Philippe Bruhat (BooK), all rights reserved.
π LICENSE π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
ok and that's the whole page, bestie!! no notes, she ate, fr fr π₯
and for the cute sign-off: this little slice of documentation came from perl v5.32.1, dated 2021-11-12, and the page itself is Test::...Handle(3pm) π«Ά mwah, go write some tests πβ¨
π¦ where this page comes from
- debian bookworm: libtest-database-perl 1.113-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtest-database-perl 1.113-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libtest-database-perl 1.113-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtest-database-perl 1.113-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-database-perl 1.113-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-database-perl 1.113-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms