This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix base.pm nonexistent module check with open files
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Tue, 14 Jan 2014 14:18:52 +0000 (14:18 +0000)
committerTony Cook <tony@develop-help.com>
Wed, 15 Jan 2014 22:36:32 +0000 (09:36 +1100)
Tony Cook: update MANIFEST

MANIFEST
dist/base/lib/base.pm
dist/base/t/base-open-chunk.t [new file with mode: 0644]
dist/base/t/base-open-line.t [new file with mode: 0644]

index efa172d..6611b88 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -2831,6 +2831,8 @@ dist/base/lib/base.pm             Establish IS-A relationship at compile time
 dist/base/lib/fields.pm                Set up object field names for pseudo-hash-using classes
 dist/base/MANIFEST             base.pm manifest
 dist/base/META.yml             base.pm META.yml file
+dist/base/t/base-open-chunk.t  See if base works
+dist/base/t/base-open-line.t   See if base works
 dist/base/t/base.t             See if base works
 dist/base/t/compile-time.t     See if base works
 dist/base/t/fields-5_6_0.t     See if fields work
index 36ae2a5..99bda20 100644 (file)
@@ -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 (file)
index 0000000..ef6c25d
--- /dev/null
@@ -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 (file)
index 0000000..ce6cf15
--- /dev/null
@@ -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;
+}