From: Ton Voon Date: Fri, 14 May 2010 22:22:57 +0000 (+0000) Subject: Another eval => try X-Git-Tag: v0.08122~57^2~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f293285319b3d812d1e945a10439b718e570e005;p=dbsrgits%2FDBIx-Class.git Another eval => try --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 925296e..0e1b103 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1714,20 +1714,25 @@ sub _dbh_execute_array { sub _dbh_execute_inserts_with_no_binds { my ($self, $sth, $count) = @_; - eval { + my $exception; + try { my $dbh = $self->_get_dbh; local $dbh->{RaiseError} = 1; local $dbh->{PrintError} = 0; $sth->execute foreach 1..$count; + } catch { + $exception = shift; }; - my $exception = $@; # Make sure statement is finished even if there was an exception. - eval { $sth->finish }; - $exception = $@ unless $exception; + try { + $sth->finish + } catch { + $exception = shift unless defined $exception; + }; - $self->throw_exception($exception) if $exception; + $self->throw_exception($exception) if defined $exception; return $count; }