This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Ensure that t/io/{print,read,say}.t load Errno at BEGIN time.
authorNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 22:42:22 +0000 (22:42 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 22:48:16 +0000 (22:48 +0000)
If Errno is loaded after the compiler has parsed the C<exists &Errno::EBADF>
later in the script, then the intent of that test is subverted - &Errno::EBADF
does not exist, at least as far as the typeglob bound to that op is concerned,
and the test for $! is skipped. I suspect that these have been skipping since
the implementation of Errno was changed in 42607a60df6df19b in May 2010 to
reduce its memory footprint by 55%.

t/io/print.t
t/io/read.t
t/io/say.t

index d29036b..321eb1e 100644 (file)
@@ -3,11 +3,12 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    require './test.pl';
+    eval 'use Errno';
+    die $@ if $@ and !is_miniperl();
 }
 
 use strict 'vars';
-eval 'use Errno';
-die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
 
 print "1..21\n";
 
index 57e671d..8cc1640 100644 (file)
@@ -4,11 +4,11 @@ BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
+    eval 'use Errno';
+    die $@ if $@ and !is_miniperl();
 }
 
 use strict;
-eval 'use Errno';
-die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
 
 plan tests => 2;
 
index 1da7a18..ead4d0b 100644 (file)
@@ -3,6 +3,9 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    require './test.pl';
+    eval 'use Errno';
+    die $@ if $@ and !is_miniperl();
 }
 
 # Just a few very basic tests cribbed from t/io/print.t,
@@ -11,9 +14,6 @@ BEGIN {
 # the same way as print in any case.
 
 use strict 'vars';
-eval 'use Errno';
-die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
-
 use feature "say";
 
 say "1..12";