Test::Database::Handle - A class for Test::Database handles
use Test::Database; my $handle = Test::Database->handle(@requests); my $dbh = $handle->dbh();
Test::Database::Handle is a very simple class for encapsulating the information about a test database handle.
Test::Database::Handle objects are used within a test script to obtain the necessary information about a test database handle. Handles are obtained through the Test::Database->handles() or Test::Database->handle() methods.
Test::Database->handles()
Test::Database->handle()
Test::Database::Handle provides the following methods:
Return a new Test::Database::Handle with the given parameters (dsn, username, password).
dsn
username
password
The only mandatory argument is dsn.
The following accessors are available.
Return the Data Source Name.
Return the connection username. Defaults to undef.
undef
Return the connection password. Defaults to undef.
Return the connection information triplet (dsn, username, password).
my ( $dsn, $username, $password ) = $handle->connection_info;
my $dbh = $handle->dbh; my $dbh = $handle->dbh( $attr );
Return the DBI database handle obtained when connecting with the connection triplet returned by connection_info().
connection_info()
The optional parameter $attr is a reference to a hash of connection attributes, passed directly to DBI's connect() method.
$attr
connect()
Return the database name attached to the handle.
Return the DBI driver name, as computed from the dsn.
Return the Test::Database::Driver object attached to the handle.
Philippe Bruhat (BooK), <book@cpan.org>
<book@cpan.org>
Copyright 2008-2010 Philippe Bruhat (BooK), all rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::Database, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Database
CPAN shell
perl -MCPAN -e shell install Test::Database
For more information on module installation, please visit the detailed CPAN module installation guide.