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(