[Bast-commits] r7585 - in DBIx-Class/0.08/trunk: lib/DBIx/Class/Storage t/storage

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun Sep 6 16:33:46 GMT 2009


Author: ribasushi
Date: 2009-09-06 16:33:46 +0000 (Sun, 06 Sep 2009)
New Revision: 7585

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/trunk/t/storage/exception.t
Log:
Stop eating exceptions in ::Storage::DBI::DESTROY

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-09-06 15:59:42 UTC (rev 7584)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-09-06 16:33:46 UTC (rev 7585)
@@ -2546,10 +2546,12 @@
 
 sub DESTROY {
   my $self = shift;
+
   $self->_verify_pid if $self->_dbh;
 
   # some databases need this to stop spewing warnings
   if (my $dbh = $self->_dbh) {
+    local $@;
     eval { $dbh->disconnect };
   }
 

Modified: DBIx-Class/0.08/trunk/t/storage/exception.t
===================================================================
--- DBIx-Class/0.08/trunk/t/storage/exception.t	2009-09-06 15:59:42 UTC (rev 7584)
+++ DBIx-Class/0.08/trunk/t/storage/exception.t	2009-09-06 16:33:46 UTC (rev 7585)
@@ -9,6 +9,8 @@
 use DBICTest;
 use DBICTest::Schema;
 
+# make sure nothing eats the exceptions (an unchecked eval in Storage::DESTROY used to be a problem)
+
 {
   package Dying::Storage;
 
@@ -29,11 +31,7 @@
   }
 }
 
-TODO: {
-local $TODO = "I have no idea what is going on here... but it ain't right";
-
 for (qw/before_populate after_populate/) {
-
   dies_ok (sub {
     my $schema = DBICTest::Schema->clone;
     $schema->storage_type ('Dying::Storage');
@@ -42,32 +40,4 @@
   }, "$_ exception found");
 }
 
-}
-
 done_testing;
-
-__END__
-For reference - next::method goes to ::Storage::DBI::_populate_dbh
-which is:
-
-sub _populate_dbh {
-  my ($self) = @_;
-
-  my @info = @{$self->_dbi_connect_info || []};
-  $self->_dbh(undef); # in case ->connected failed we might get sent here 
-  $self->_dbh($self->_connect(@info));
-
-  $self->_conn_pid($$);
-  $self->_conn_tid(threads->tid) if $INC{'threads.pm'};
-
-  $self->_determine_driver;
-
-  # Always set the transaction depth on connect, since 
-  #  there is no transaction in progress by definition 
-  $self->{transaction_depth} = $self->_dbh_autocommit ? 0 : 1;
-
-  $self->_run_connection_actions unless $self->{_in_determine_driver};
-}
-
-After further tracing it seems that if I die() before $self->_conn_pid($$)
-the exception is propagated. If I die after it - it's lost. What The Fuck?!




More information about the Bast-commits mailing list