Hmm, the data is in the database. Why can't Rose::DB::Object see it? I'm using transactions and I'm rolling things back (because this is a test environment), so it's probably related to transactions. But I thought Rose and my test environment were sharing the database handle. Just to be sure, let's check to see how many times we're connecting to the database. I'm expecting twice.
use DBI; use Hook::LexWrap; wrap 'DBI::connect', pre => sub { my ( $package, $filename, $line ) = caller(1); warn "DBI->connect called in $filename\n\tpackage $package at line $line\n\n"; };
Hmm, let's see what that dumps out.
DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in /usr/local/lib/perl5/site_perl/5.8.7/Rose/DB/MySQL.pm package Rose::DB::MySQL at line 71 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in /usr/local/lib/perl5/site_perl/5.8.7/Rose/DB.pm package Rose::DB at line 1968 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130 DBI->connect called in t/lib/ProdDev/Test/Database.pm package ProdDev::Test::Database at line 130
Hey, that's not twice. Damn.