################## ./t/mock_db_test.t ################## use Test::More qw(no_plan); use strict; use warnings; ### Just a blank test so this sample runs. ok(1,'baseline test'); ### Load DBI and create a handle. use DBI; my $dbh = DBI->connect('DBI:Mock:', '', ''); ### Load the sample data set into memory and add it as a resultset to the ### mock db driver. use t::sample_db_data_test; $dbh->{'mock_add_resultset'} = \@t::sample_db_data_test::Accounts; ### Try to get just the name and description. my $sth = $dbh->prepare('SELECT name, description FROM Accounts WHERE id=?'); if ($sth->execute(3)) { ### Successful query. my @results = $sth->fetchrow_array; use Data::Dumper; diag(Dumper(\@results)); } else { ### Failure... diag('Some weird error: ' . $sth->errstr); }