From: Brandon L. Black Date: Thu, 14 Jun 2007 19:54:13 +0000 (+0000) Subject: weaken the storage reference in the HandleError closure! X-Git-Tag: v0.08010~150^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=664612fb99e660306214ca4bf8008a4c16a04d5b;p=dbsrgits%2FDBIx-Class.git weaken the storage reference in the HandleError closure! --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 0741c3a..d7b9cf9 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -10,7 +10,7 @@ use SQL::Abstract::Limit; use DBIx::Class::Storage::DBI::Cursor; use DBIx::Class::Storage::Statistics; use IO::File; -use Scalar::Util 'blessed'; +use Scalar::Util qw/blessed weaken/; __PACKAGE__->mk_group_accessors('simple' => qw/_connect_info _dbi_connect_info _dbh _sql_maker _sql_maker_opts @@ -768,8 +768,10 @@ sub _connect { } if(!$self->unsafe) { + my $weak_self = $self; + weaken($weak_self); $dbh->{HandleError} = sub { - $self->throw_exception("DBI Exception: $_[0]") + $weak_self->throw_exception("DBI Exception: $_[0]") }; $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0;