X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=blobdiff_plain;f=lib%2FTest%2FValgrind.pm;h=3c52e85bc814416e96797d65dc13f5c0516ad042;hp=601a949997f5991b7c7df4a0f17f402ba9d414d4;hb=14d9a30088d40282446f97180ac6e383fa9ababf;hpb=6d0c733b0b8ab2f10413a7b1c2906a7f28824f77 diff --git a/lib/Test/Valgrind.pm b/lib/Test/Valgrind.pm index 601a949..3c52e85 100644 --- a/lib/Test/Valgrind.pm +++ b/lib/Test/Valgrind.pm @@ -220,22 +220,27 @@ sub import { return; } - my ($file, $pm, $next); - my $l = 0; - while ($l < 1000) { - $next = (caller $l++)[1]; - last unless defined $next; - next if $next eq '-e' or $next =~ /^\s*\(\s*eval\s*\d*\s*\)\s*$/ or !-f $next; - if ($next =~ /\.pm$/) { - $pm = $next; - } else { - $file = $next; + my $file = delete $args{file}; + unless (defined $file) { + my ($pm, $next); + my $l = 0; + while ($l < 1000) { + $next = (caller $l++)[1]; + last unless defined $next; + next if $next eq '-e' + or $next =~ /^\s*\(\s*eval\s*\d*\s*\)\s*$/ + or !-f $next; + if ($next =~ /\.pm$/) { + $pm = $next; + } else { + $file = $next; + } + } + unless (defined($file) or defined($file = $pm)) { + require Test::Builder; + Test::Builder->new->diag('Couldn\'t find a valid source file'); + return; } - } - unless (defined($file) or defined($file = $pm)) { - require Test::Builder; - Test::Builder->new->diag('Couldn\'t find a valid source file'); - return; } exit $class->analyse(