]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind.pm
This is 0.06
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind.pm
index eb9fcb402fb87df0f3e44e4620654e1d2f1d7202..34ff5d903cc5c75ee06c7b2152870749ec789047 100644 (file)
@@ -17,11 +17,11 @@ Test::Valgrind - Test Perl code through valgrind.
 
 =head1 VERSION
 
-Version 0.051
+Version 0.06
 
 =cut
 
-our $VERSION = '0.051';
+our $VERSION = '0.06';
 
 =head1 SYNOPSIS
 
@@ -114,14 +114,23 @@ sub import {
  croak 'Optional arguments must be passed as key => value pairs' if @_ % 2;
  my %args = @_;
  if (!defined $args{run} && !$run) {
-  my ($file, $next);
+  my ($file, $pm, $next);
   my $l = 0;
   while ($l < 1000) {
    $next = (caller $l++)[1];
    last unless defined $next;
-   $file = $next;
+   next unless $next ne '-e' and $next !~ /^\s*\(\s*eval\s*\d*\s*\)\s*$/
+                             and -f $next;
+   if ($next =~ /\.pm$/) {
+    $pm = $next;
+   } else {
+    $file = $next;
+   }
+  }
+  unless (defined $file) {
+   $file = $pm;
+   return unless defined $pm;
   }
-  return if not $file or $file eq '-e';
   my $callers = $args{callers};
   $callers = 12 unless defined $callers;
   $callers = int $callers;