From: Ton Voon Date: Fri, 14 May 2010 22:03:03 +0000 (+0000) Subject: Add eval => try X-Git-Tag: v0.08122~57^2~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e326a7c23be1ed24387395a95ea4ecf48faed7f0;p=dbsrgits%2FDBIx-Class.git Add eval => try --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 98c9f91..925296e 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1014,7 +1014,7 @@ sub _server_info { my $server_version = do { local $@; # might be happenin in some sort of destructor - eval { $self->_get_server_version }; + try { $self->_get_server_version }; }; if (defined $server_version) { @@ -1172,7 +1172,8 @@ sub _connect { $DBI::connect_via = 'connect'; } - eval { + my $caught; + try { if(ref $info[0] eq 'CODE') { $dbh = $info[0]->(); } @@ -1197,12 +1198,14 @@ sub _connect { $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; } + } catch { + $caught = 1; }; $DBI::connect_via = $old_connect_via if $old_connect_via; $self->throw_exception("DBI Connection failed: " . ($@||$DBI::errstr)) - if !$dbh || $@; + if !$dbh || $caught; $self->_dbh_autocommit($dbh->{AutoCommit});