summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJohn Lightsey <lightsey@debian.org>2016-12-23 12:35:45 -0500
committerJames E Keenan <jkeenan@cpan.org>2016-12-23 13:52:28 -0500
commit1ae6ead94905dfee43773cf3b18949c91b33f9d1 (patch)
tree6a54545d46d1ae3f61696e23111a21c736b3b2b5 /ext
parent7527883f8c7b71d808abdbd3cff07f61280a42b5 (diff)
downloadperl-1ae6ead94905dfee43773cf3b18949c91b33f9d1.tar.gz
Switch most open() calls to three-argument form.
Switch from two-argument form. Filehandle cloning is still done with the two argument form for backward compatibility. Committer: Get all porting tests to pass. Increment some $VERSIONs. Run: ./perl -Ilib regen/mk_invlists.pl; ./perl -Ilib regen/regcharclass.pl For: RT #130122
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B/Xref.pm4
-rw-r--r--ext/B/t/OptreeCheck.pm4
-rw-r--r--ext/B/t/xref.t2
-rw-r--r--ext/Devel-Peek/t/Peek.t10
-rw-r--r--ext/DynaLoader/DynaLoader_pm.PL4
-rw-r--r--ext/Errno/Errno_pm.PL12
-rw-r--r--ext/Fcntl/t/syslfs.t2
-rw-r--r--ext/File-Glob/t/basic.t2
-rw-r--r--ext/FileCache/t/02maxopen.t2
-rw-r--r--ext/GDBM_File/t/fatal.t2
-rw-r--r--ext/IPC-Open3/t/IPC-Open3.t2
-rw-r--r--ext/IPC-Open3/t/fd.t2
-rw-r--r--ext/POSIX/t/sysconf.t2
-rw-r--r--ext/PerlIO-encoding/t/encoding.t10
-rw-r--r--ext/PerlIO-encoding/t/fallback.t6
-rw-r--r--ext/PerlIO-via/t/via.t4
-rw-r--r--ext/Pod-Html/t/pod2html-lib.pl4
-rw-r--r--ext/VMS-DCLsym/DCLsym.pm4
-rw-r--r--ext/XS-APItest/Makefile.PL2
-rw-r--r--ext/XS-APItest/t/printf.t2
-rw-r--r--ext/XS-Typemap/t/Typemap.t2
21 files changed, 42 insertions, 42 deletions
diff --git a/ext/B/B/Xref.pm b/ext/B/B/Xref.pm
index 8beb243f71..255ee890bd 100644
--- a/ext/B/B/Xref.pm
+++ b/ext/B/B/Xref.pm
@@ -1,6 +1,6 @@
package B::Xref;
-our $VERSION = '1.05';
+our $VERSION = '1.06';
=head1 NAME
@@ -449,7 +449,7 @@ sub compile {
last OPTION;
} elsif ($opt eq "o") {
$arg ||= shift @options;
- open(STDOUT, ">$arg") or return "$arg: $!\n";
+ open(STDOUT, '>', $arg) or return "$arg: $!\n";
} elsif ($opt eq "d") {
$nodefs = 1;
} elsif ($opt eq "r") {
diff --git a/ext/B/t/OptreeCheck.pm b/ext/B/t/OptreeCheck.pm
index 3ae19304d7..e7af99ece1 100644
--- a/ext/B/t/OptreeCheck.pm
+++ b/ext/B/t/OptreeCheck.pm
@@ -5,7 +5,7 @@ use warnings;
use vars qw($TODO $Level $using_open);
require "test.pl";
-our $VERSION = '0.14';
+our $VERSION = '0.15';
# now export checkOptree, and those test.pl functions used by tests
our @EXPORT = qw( checkOptree plan skip skip_all pass is like unlike
@@ -1001,7 +1001,7 @@ sub OptreeCheck::processExamples {
# turned into optreeCheck tests,
foreach my $file (@files) {
- open (my $fh, $file) or die "cant open $file: $!\n";
+ open (my $fh, '<', $file) or die "cant open $file: $!\n";
$/ = "";
my @chunks = <$fh>;
print preamble (scalar @chunks);
diff --git a/ext/B/t/xref.t b/ext/B/t/xref.t
index 32a80e73d5..3e201c12e1 100644
--- a/ext/B/t/xref.t
+++ b/ext/B/t/xref.t
@@ -32,7 +32,7 @@ open STDOUT, ">&SAVEOUT" or diag $!;
# line 200
my ($curfile, $cursub, $curpack) = ('') x 3;
our %xreftable = ();
-open XREF, $file or die "# Can't open $file: $!\n";
+open XREF, '<', $file or die "# Can't open $file: $!\n";
while (<XREF>) {
print STDERR $_ if $ENV{PERL_DEBUG};
chomp;
diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t
index 07f651073b..d62e3b21a1 100644
--- a/ext/Devel-Peek/t/Peek.t
+++ b/ext/Devel-Peek/t/Peek.t
@@ -37,7 +37,7 @@ sub do_test {
my $repeat_todo = $_[4];
my $pattern = $_[2];
my $do_eval = $_[5];
- if (open(OUT,">peek$$")) {
+ if (open(OUT,'>', "peek$$")) {
open(STDERR, ">&OUT") or die "Can't dup OUT: $!";
if ($do_eval) {
my $sub = eval "sub { Dump $_[1] }";
@@ -56,7 +56,7 @@ sub do_test {
}
open(STDERR, ">&SAVERR") or die "Can't restore STDERR: $!";
close(OUT);
- if (open(IN, "peek$$")) {
+ if (open(IN, '<', "peek$$")) {
local $/;
$pattern =~ s/\$ADDR/0x[[:xdigit:]]+/g;
$pattern =~ s/\$FLOAT/(?:\\d*\\.\\d+(?:e[-+]\\d+)?|\\d+)/g;
@@ -1146,7 +1146,7 @@ unless ($Config{useithreads}) {
# (One block of study tests removed when study was made a no-op.)
{
- open(OUT,">peek$$") or die "Failed to open peek $$: $!";
+ open(OUT, '>', "peek$$") or die "Failed to open peek $$: $!";
open(STDERR, ">&OUT") or die "Can't dup OUT: $!";
DeadCode();
open(STDERR, ">&SAVERR") or die "Can't restore STDERR: $!";
@@ -1232,12 +1232,12 @@ do_test('UTF-8 in a regular expression',
use utf8;
sub _dump {
- open(OUT,">peek$$") or die $!;
+ open(OUT, '>', "peek$$") or die $!;
open(STDERR, ">&OUT") or die "Can't dup OUT: $!";
Dump($_[0]);
open(STDERR, ">&SAVERR") or die "Can't restore STDERR: $!";
close(OUT);
- open(IN, "peek$$") or die $!;
+ open(IN, '<', "peek$$") or die $!;
my $dump = do { local $/; <IN> };
close(IN);
1 while unlink "peek$$";
diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL
index ee348c80ea..24c8bea36c 100644
--- a/ext/DynaLoader/DynaLoader_pm.PL
+++ b/ext/DynaLoader/DynaLoader_pm.PL
@@ -65,7 +65,7 @@ sub expand_os_specific {
}
unlink "DynaLoader.pm" if -f "DynaLoader.pm";
-open OUT, ">DynaLoader.pm" or die $!;
+open OUT, '>', "DynaLoader.pm" or die $!;
print OUT <<'EOT';
# Generated from DynaLoader_pm.PL, this file is unique for every OS
@@ -85,7 +85,7 @@ package DynaLoader;
# Tim.Bunce@ig.co.uk, August 1994
BEGIN {
- $VERSION = '1.40';
+ $VERSION = '1.41';
}
EOT
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index 8b1286dde6..d345e98042 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
use Config;
use strict;
-our $VERSION = "1.27";
+our $VERSION = "1.28";
my %err = ();
@@ -13,7 +13,7 @@ my $IsMSWin32 = $^O eq 'MSWin32' && !$IsSymbian;
unlink "Errno.pm" if -f "Errno.pm";
unlink "Errno.tmp" if -f "Errno.tmp";
-open OUT, ">Errno.tmp" or die "Cannot open Errno.tmp: $!";
+open OUT, '>', 'Errno.tmp' or die "Cannot open Errno.tmp: $!";
select OUT;
my $file;
my @files = get_files();
@@ -21,7 +21,7 @@ if ($Config{gccversion} ne '' && $^O eq 'MSWin32') {
# MinGW complains "warning: #pragma system_header ignored outside include
# file" if the header files are processed individually, so include them
# all in .c file and process that instead.
- open INCS, '>includes.c' or
+ open INCS, '>', 'includes.c' or
die "Cannot open includes.c";
foreach $file (@files) {
next if $file eq 'errno.c';
@@ -68,7 +68,7 @@ sub process_file {
return;
}
} else {
- unless(open(FH,"< $file")) {
+ unless(open(FH, '<', $file)) {
# This file could be a temporary file created by cppstdin
# so only warn under -w, and return
warn "Cannot open '$file'" if $^W;
@@ -149,7 +149,7 @@ sub get_files {
$SDK =~ s!\\!/!g;
$file{"$SDK/epoc32/include/libc/sys/errno.h"} = 1;
} else {
- open(CPPI,"> errno.c") or
+ open(CPPI, '>', 'errno.c') or
die "Cannot open errno.c";
if ($^O eq 'NetWare') {
@@ -200,7 +200,7 @@ sub write_errno_pm {
# create the CPP input
- open(CPPI,"> errno.c") or
+ open(CPPI, '>', 'errno.c') or
die "Cannot open errno.c";
if ($^O eq 'NetWare') {
diff --git a/ext/Fcntl/t/syslfs.t b/ext/Fcntl/t/syslfs.t
index 09dea10453..00e072ba60 100644
--- a/ext/Fcntl/t/syslfs.t
+++ b/ext/Fcntl/t/syslfs.t
@@ -234,7 +234,7 @@ explain() unless Test::Builder->new()->is_passing();
END {
# unlink may fail if applied directly to a large file
# be paranoid about leaving 5 gig files lying around
- open(BIG, ">$big0"); # truncate
+ open(BIG, '>', $big0); # truncate
close(BIG);
}
diff --git a/ext/File-Glob/t/basic.t b/ext/File-Glob/t/basic.t
index 2e6a4748d4..1e264a2eb1 100644
--- a/ext/File-Glob/t/basic.t
+++ b/ext/File-Glob/t/basic.t
@@ -192,7 +192,7 @@ if ($^O eq 'VMS') { # VMS is happily caseignorant
}
for (@f_names) {
- open T, "> $_";
+ open T, '>', $_;
close T;
}
diff --git a/ext/FileCache/t/02maxopen.t b/ext/FileCache/t/02maxopen.t
index c95ba73bca..00dbb1bd54 100644
--- a/ext/FileCache/t/02maxopen.t
+++ b/ext/FileCache/t/02maxopen.t
@@ -19,7 +19,7 @@ use Test::More tests => 5;
next unless fileno($path);
print $path "$path 2\n";
close($path);
- open($path, $path);
+ open($path, '<', $path);
<$path>;
push @cat, <$path>;
close($path);
diff --git a/ext/GDBM_File/t/fatal.t b/ext/GDBM_File/t/fatal.t
index b7045bad69..0e426d4dbc 100644
--- a/ext/GDBM_File/t/fatal.t
+++ b/ext/GDBM_File/t/fatal.t
@@ -18,7 +18,7 @@ BEGIN {
unlink <Op_dbmx*>;
-open my $fh, $^X or die "Can't open $^X: $!";
+open my $fh, '<', $^X or die "Can't open $^X: $!";
my $fileno = fileno $fh;
isnt($fileno, undef, "Can find next available file descriptor");
close $fh or die $!;
diff --git a/ext/IPC-Open3/t/IPC-Open3.t b/ext/IPC-Open3/t/IPC-Open3.t
index 25cfdfb6ae..aa196e5cf2 100644
--- a/ext/IPC-Open3/t/IPC-Open3.t
+++ b/ext/IPC-Open3/t/IPC-Open3.t
@@ -210,7 +210,7 @@ foreach my $handle (qw (DUMMY STDIN STDOUT STDERR)) {
my $out = IO::Handle->new();
my $pid = eval {
local $SIG{__WARN__} = sub {
- open my $fh, '>/dev/tty';
+ open my $fh, '>', '/dev/tty';
return if "@_" =~ m!^Use of uninitialized value \$fd.*IO/Handle\.pm!;
print $fh "@_";
die @_
diff --git a/ext/IPC-Open3/t/fd.t b/ext/IPC-Open3/t/fd.t
index 2a71b1387c..adb1f5cd65 100644
--- a/ext/IPC-Open3/t/fd.t
+++ b/ext/IPC-Open3/t/fd.t
@@ -36,7 +36,7 @@ plan 3;
fresh_perl_like(<<"EOP",
use IPC::Open3;
-open FOO, '$file' or die \$!;
+open FOO, '<', '$file' or die \$!;
open3('<&' . fileno FOO, my \$out, undef, \$ENV{PERLEXE}, '-eprint scalar <STDIN>');
print <\$out>;
EOP
diff --git a/ext/POSIX/t/sysconf.t b/ext/POSIX/t/sysconf.t
index f23e0d3b3b..29cf20f210 100644
--- a/ext/POSIX/t/sysconf.t
+++ b/ext/POSIX/t/sysconf.t
@@ -110,7 +110,7 @@ SKIP: {
-c $TTY
or skip("$TTY not a character file", $n);
- open(TTY, $TTY)
+ open(TTY, '<', $TTY)
or skip("failed to open $TTY: $!", $n);
-t TTY
or skip("TTY ($TTY) not a terminal file", $n);
diff --git a/ext/PerlIO-encoding/t/encoding.t b/ext/PerlIO-encoding/t/encoding.t
index cba14a8243..088f89ee20 100644
--- a/ext/PerlIO-encoding/t/encoding.t
+++ b/ext/PerlIO-encoding/t/encoding.t
@@ -25,7 +25,7 @@ my $fail2 = "fb$$";
my $russki = "koi8r$$";
my $threebyte = "3byte$$";
-if (open(GRK, ">$grk")) {
+if (open(GRK, '>', $grk)) {
binmode(GRK, ":bytes");
# alpha beta gamma in ISO 8859-7
print GRK "\xe1\xe2\xe3";
@@ -40,7 +40,7 @@ if (open(GRK, ">$grk")) {
close($i);
}
-if (open(UTF, "<$utf")) {
+if (open(UTF, '<', $utf)) {
binmode(UTF, ":bytes");
# alpha beta gamma in UTF-8 Unicode (0x3b1 0x3b2 0x3b3)
@@ -57,7 +57,7 @@ if (open(UTF, "<$utf")) {
close($i);
}
-if (open(GRK, "<$grk")) {
+if (open(GRK, '<', $grk)) {
binmode(GRK, ":bytes");
is(scalar <GRK>, "\xe1\xe2\xe3");
close GRK;
@@ -68,10 +68,10 @@ $SIG{__WARN__} = sub {$warn .= $_[0]};
is (open(FAIL, ">:encoding(NoneSuch)", $fail1), undef, 'Open should fail');
like($warn, qr/^Cannot find encoding "NoneSuch" at/);
-is(open(RUSSKI, ">$russki"), 1);
+is(open(RUSSKI, '>', $russki), 1);
print RUSSKI "\x3c\x3f\x78";
close RUSSKI or die "Could not close: $!";
-open(RUSSKI, "$russki");
+open(RUSSKI, '<', $russki);
binmode(RUSSKI, ":raw");
my $buf1;
read(RUSSKI, $buf1, 1);
diff --git a/ext/PerlIO-encoding/t/fallback.t b/ext/PerlIO-encoding/t/fallback.t
index cf3fdc325e..3abdfd3f37 100644
--- a/ext/PerlIO-encoding/t/fallback.t
+++ b/ext/PerlIO-encoding/t/fallback.t
@@ -33,7 +33,7 @@ my $file = "fallback$$.txt";
like($message, qr/does not map to iso-8859-1/o, "FB_WARN message");
}
-open($fh,$file) || die "File cannot be re-opened";
+open($fh,'<',$file) || die "File cannot be re-opened";
my $line = <$fh>;
is($line,"\\x{20ac}0.02\n","perlqq escapes");
close($fh);
@@ -45,14 +45,14 @@ my $str = "\x{20AC}";
print $fh $str,"0.02\n";
close($fh);
-open($fh,$file) || die "File cannot be re-opened";
+open($fh,'<',$file) || die "File cannot be re-opened";
my $line = <$fh>;
is($line,"&#8364;0.02\n","HTML escapes");
close($fh);
{
no utf8;
- open($fh,">$file") || die "File cannot be re-opened";
+ open($fh,'>',$file) || die "File cannot be re-opened";
binmode($fh);
print $fh "\xA30.02\n";
close($fh);
diff --git a/ext/PerlIO-via/t/via.t b/ext/PerlIO-via/t/via.t
index 0619592606..6787e11cc4 100644
--- a/ext/PerlIO-via/t/via.t
+++ b/ext/PerlIO-via/t/via.t
@@ -44,7 +44,7 @@ is($a, $b, 'compare original data with filtered version');
use warnings 'layer';
# Find fd number we should be using
- my $fd = open($fh,">$tmp") && fileno($fh);
+ my $fd = open($fh,'>',$tmp) && fileno($fh);
print $fh "Hello\n";
close($fh);
@@ -52,7 +52,7 @@ is($a, $b, 'compare original data with filtered version');
like( $warnings, qr/^Cannot find package 'Unknown::Module'/, 'warn about unknown package' );
# Now open normally again to see if we get right fileno
- my $fd2 = open($fh,"<$tmp") && fileno($fh);
+ my $fd2 = open($fh,'<',$tmp) && fileno($fh);
is($fd2,$fd,"Wrong fd number after failed open");
my $data = <$fh>;
diff --git a/ext/Pod-Html/t/pod2html-lib.pl b/ext/Pod-Html/t/pod2html-lib.pl
index 27e3e94b96..dfe309ab84 100644
--- a/ext/Pod-Html/t/pod2html-lib.pl
+++ b/ext/Pod-Html/t/pod2html-lib.pl
@@ -70,7 +70,7 @@ sub convert_n_test {
}
# result
- open my $in, $outfile or die "cannot open $outfile: $!";
+ open my $in, '<', $outfile or die "cannot open $outfile: $!";
$result = <$in>;
close $in;
}
@@ -88,7 +88,7 @@ sub convert_n_test {
open my $tmpfile, ">", $expectfile or die $!;
print $tmpfile $expect;
close $tmpfile;
- open my $diff_fh, "$diff $diffopt $expectfile $outfile |" or die $!;
+ open my $diff_fh, "-|", "$diff $diffopt $expectfile $outfile" or die $!;
print STDERR "# $_" while <$diff_fh>;
close $diff_fh;
unlink $expectfile;
diff --git a/ext/VMS-DCLsym/DCLsym.pm b/ext/VMS-DCLsym/DCLsym.pm
index b239e1572d..6990e2af5a 100644
--- a/ext/VMS-DCLsym/DCLsym.pm
+++ b/ext/VMS-DCLsym/DCLsym.pm
@@ -7,7 +7,7 @@ use strict;
# Package globals
@ISA = ( 'DynaLoader' );
-$VERSION = '1.07';
+$VERSION = '1.08';
my(%Locsyms) = ( ':ID' => 'LOCAL' );
my(%Gblsyms) = ( ':ID' => 'GLOBAL');
my $DoCache = 1;
@@ -105,7 +105,7 @@ sub FIRSTKEY {
if (!$DoCache || !$Cache_set) {
# We should eventually replace this with a C routine which walks the
# CLI symbol table directly. If I ever get 'hold of an I&DS manual . . .
- open(P,'Show Symbol * |');
+ open(P, '-|', 'Show Symbol *');
while (<P>) {
($name,$eqs,$val) = /^\s+(\S+) (=+) (.+)/
or carp "VMS::DCLsym: unparseable line $_";
diff --git a/ext/XS-APItest/Makefile.PL b/ext/XS-APItest/Makefile.PL
index c06fac6f22..d46fa64dcf 100644
--- a/ext/XS-APItest/Makefile.PL
+++ b/ext/XS-APItest/Makefile.PL
@@ -31,7 +31,7 @@ my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
),
{name=>"G_WANT", default=>["IV", "G_ARRAY|G_VOID"]});
-open my $fh, '../../overload.h' or die "Can't open ../../overload.h: $!";
+open my $fh, '<', '../../overload.h' or die "Can't open ../../overload.h: $!";
while (<$fh>) {
push @names, {name => $1, macro => 1} if /^\s+([A-Za-z_0-9]+_amg),/;
}
diff --git a/ext/XS-APItest/t/printf.t b/ext/XS-APItest/t/printf.t
index 8f43ee2532..968fdc4627 100644
--- a/ext/XS-APItest/t/printf.t
+++ b/ext/XS-APItest/t/printf.t
@@ -34,7 +34,7 @@ print_flush();
# Now redirect STDOUT and read from the file
ok open(STDOUT, ">&", $oldout), "restore STDOUT";
-ok open(my $foo, "<foo.out"), "open foo.out";
+ok open(my $foo, '<', 'foo.out'), "open foo.out";
#print "# Test output by reading from file\n";
# now test the output
my @output = map { chomp; $_ } <$foo>;
diff --git a/ext/XS-Typemap/t/Typemap.t b/ext/XS-Typemap/t/Typemap.t
index 46ab20fd11..3e56b573d6 100644
--- a/ext/XS-Typemap/t/Typemap.t
+++ b/ext/XS-Typemap/t/Typemap.t
@@ -381,7 +381,7 @@ if (defined $fh) {
ok( $Config{useperlio} ? T_STDIO_close( $fh ) : close( $fh ) );
# open from perl, and check contents
- open($fh, "< $testfile");
+ open($fh, '<', $testfile);
ok($fh);
my $line = <$fh>;
is($line,$lines[0]);