diff options
author | Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> | 2014-01-14 14:18:52 +0000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-01-16 09:36:32 +1100 |
commit | 6a601575dc53f1a1812f54d50e99fe12976bcc0a (patch) | |
tree | 496df54875f42726e3ca4ebe7d74f7dfac4b31ba /dist/base | |
parent | 6f974f68a204015dd60d6dc9684dd2234170d176 (diff) | |
download | perl-6a601575dc53f1a1812f54d50e99fe12976bcc0a.tar.gz |
Fix base.pm nonexistent module check with open files
Tony Cook: update MANIFEST
Diffstat (limited to 'dist/base')
-rw-r--r-- | dist/base/lib/base.pm | 4 | ||||
-rw-r--r-- | dist/base/t/base-open-chunk.t | 14 | ||||
-rw-r--r-- | dist/base/t/base-open-line.t | 12 |
3 files changed, 28 insertions, 2 deletions
diff --git a/dist/base/lib/base.pm b/dist/base/lib/base.pm index 36ae2a5540..99bda20e77 100644 --- a/dist/base/lib/base.pm +++ b/dist/base/lib/base.pm @@ -107,8 +107,8 @@ sub import { # probably be using parent.pm, which doesn't try to # guess whether require is needed or failed, # see [perl #118561] - die if $@ && $@ !~ /^Can't locate \Q$fn\E .*? at \Q$file\E line \Q$line\E\.\n\z/s - || $@ =~ /Compilation failed in require at \Q$file\E line \Q$line\E\.\n\z/; + die if $@ && $@ !~ /^Can't locate \Q$fn\E .*? at \Q$file\E line \Q$line\E(?:, <[^>]*> (?:line|chunk) [0-9]+)?\.\n\z/s + || $@ =~ /Compilation failed in require at \Q$file\E line \Q$line\E(?:, <[^>]*> (?:line|chunk) [0-9]+)?\.\n\z/; unless (%{"$base\::"}) { require Carp; local $" = " "; diff --git a/dist/base/t/base-open-chunk.t b/dist/base/t/base-open-chunk.t new file mode 100644 index 0000000000..ef6c25d201 --- /dev/null +++ b/dist/base/t/base-open-chunk.t @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w + +my $file = __FILE__; + +open my $fh, '<', $file or die "Can't open $file: $!"; +$/ = \1; +<$fh>; +(my $test_file = $file) =~ s/-open-chunk//; + +unless (my $return = do $test_file) { + warn "couldn't parse $test_file: $@" if $@; + warn "couldn't do $test_file: $!" unless defined $return; + warn "couldn't run $test_file" unless $return; +} diff --git a/dist/base/t/base-open-line.t b/dist/base/t/base-open-line.t new file mode 100644 index 0000000000..ce6cf1538d --- /dev/null +++ b/dist/base/t/base-open-line.t @@ -0,0 +1,12 @@ +#!/usr/bin/perl -w + +my $file = __FILE__; +open my $fh, '<', $file or die "Can't open $file: $!"; +<$fh>; +(my $test_file = $file) =~ s/-open-line//; + +unless (my $return = do $test_file) { + warn "couldn't parse $test_file: $@" if $@; + warn "couldn't do $test_file: $!" unless defined $return; + warn "couldn't run $test_file" unless $return; +} |