From: Ton Voon Date: Mon, 17 May 2010 12:52:28 +0000 (+0000) Subject: Fix missing $@ in try::tiny conversion X-Git-Tag: v0.08122~57^2~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=4cf392a17cae90f02305e0d122953b3927780d1c Fix missing $@ in try::tiny conversion --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 686d0eb..20c1b1a 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1177,7 +1177,7 @@ sub _connect { $DBI::connect_via = 'connect'; } - my $caught; + my $exception; try { if(ref $info[0] eq 'CODE') { $dbh = $info[0]->(); @@ -1204,13 +1204,13 @@ sub _connect { $dbh->{PrintError} = 0; } } catch { - $caught = 1; + $exception = $_; }; $DBI::connect_via = $old_connect_via if $old_connect_via; - $self->throw_exception("DBI Connection failed: " . ($@||$DBI::errstr)) - if !$dbh || $caught; + $self->throw_exception("DBI Connection failed: " . ((defined $exception && $exception) || $DBI::errstr)) + if !$dbh || defined $exception; $self->_dbh_autocommit($dbh->{AutoCommit});