]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/commitdiff
Fix the session not calling ->finish at the right time
authorVincent Pit <vince@profvince.com>
Thu, 15 Apr 2010 06:30:39 +0000 (08:30 +0200)
committerVincent Pit <vince@profvince.com>
Thu, 15 Apr 2010 06:30:39 +0000 (08:30 +0200)
lib/Test/Valgrind/Session.pm

index 81f195654edd8cf5fd6d93716d11ca8d5232b5e9..95a0130021e4c8f6ac971133ec37fa04011d6f7e 100644 (file)
@@ -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<action>