Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Monday June 04, 2007
05:01 AM

DBI-connect and connect and connect ...

[ #33417 ]

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.