From: Vincent Pit Date: Thu, 15 Apr 2010 06:30:39 +0000 (+0200) Subject: Fix the session not calling ->finish at the right time X-Git-Tag: v1.13~7 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=ce3b70ae39a2403e9387ab28736597c4554bdc47;p=perl%2Fmodules%2FTest-Valgrind.git Fix the session not calling ->finish at the right time --- diff --git a/lib/Test/Valgrind/Session.pm b/lib/Test/Valgrind/Session.pm index 81f1956..95a0130 100644 --- a/lib/Test/Valgrind/Session.pm +++ b/lib/Test/Valgrind/Session.pm @@ -177,7 +177,7 @@ sub run { my %args = @_; $self->start(%args); - my $guard = bless sub { $self->finish } => 'Test::Valgrind::Session::Guard'; + my $guard = Test::Valgrind::Session::Guard->new(sub { $self->finish }); $self->_run($args{command}); } @@ -271,7 +271,9 @@ sub _run { return; } -sub Test::Valgrind::Session::Guard::DESTROY { $_[0]->() } +sub Test::Valgrind::Session::Guard::new { bless \($_[1]), $_[0] } + +sub Test::Valgrind::Session::Guard::DESTROY { ${$_[0]}->() } =head2 C