die("Please run me as generate_config_sh path/to/original/config.sh");
}
-open(FILE, "$config") || die("Unable to open $config");
+open(FILE, '<', $config) || die("Unable to open $config");
my $line_in;
while ($line_in = <FILE>) {
$patchlevel ||= $Config{version};
$patchlevel = qq["$patchlevel"];
-open(SH,"<$name") || die "Cannot open $name:$!";
+open(SH,'<',$name) || die "Cannot open $name:$!";
while (<SH>)
{
last if /^sed/;
die "$str:$@" if $@;
-open(H,">$file.new") || die "Cannot open $file.new:$!";
+open(H,'>',"$file.new") || die "Cannot open $file.new:$!";
binmode H; # no CRs (which cause a spurious rebuild)
while (<SH>)
{
shift @ARGV;
my $optfile = shift @ARGV;
local (*F);
- open OPTF, $optfile or die "Can't open $optfile: $!\n";
+ open OPTF, '<', $optfile or die "Can't open $optfile: $!\n";
my @opts;
chomp(my $line = <OPTF>);
my @vars = split(/\t+~\t+/, $line);
my $pl_h = '../patchlevel.h';
if (-e $pl_h) {
- open PL, "<$pl_h" or die "Can't open $pl_h: $!";
+ open PL, '<', $pl_h or die "Can't open $pl_h: $!";
while (<PL>) {
if (/^#\s*define\s+(PERL_\w+)\s+([\d.]+)/) {
$opt{$1} = $2;
# Do the processing only if the file has '.t' extension.
if($ext eq '.t') {
- open(FH, "+< $FileToProcess") or die "Unable to open the file, $FileToProcess for reading and writing.\n";
+ open(FH, '+<', $FileToProcess) or die "Unable to open the file, $FileToProcess for reading and writing.\n";
@ARRAY = <FH>; # Get the contents of the file into an array.
foreach $Line(@ARRAY) # Get each line of the file.
# Open once in write mode since later files are opened in append mode,
# and if there already exists a file with the same name, all further opens
# will append to that file!!
- open(FHW, "> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for writing.\n";
+ open(FHW, '>', $IntAutoScript) or die "Unable to open the file, $IntAutoScript for writing.\n";
seek(FHW, 0, 0); # seek to the beginning of the file.
close FHW; # close the file.
}
print "Generating t/nwauto.pl ...\n\n\n";
-open(FHWA, "> t/nwauto.pl") or die "Unable to open the file, t/nwauto.pl for writing.\n";
+open(FHWA, '>', 't/nwauto.pl') or die "Unable to open the file, t/nwauto.pl for writing.\n";
seek(FHWA, 0, 0); # seek to the beginning of the file.
$version = sprintf("%vd",$^V);
}
# Write into the intermediary auto script.
- open(FHW, ">> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for appending.\n";
+ open(FHW, '>>', $IntAutoScript) or die "Unable to open the file, $IntAutoScript for appending.\n";
seek(FHW, 0, 2); # seek to the end of the file.
$pos = tell(FHW);
$IntAutoScript = "t/".$DirItem.".pl";
# Write into the intermediary auto script.
- open(FHW, ">> $IntAutoScript") or die "Unable to open the file, $IntAutoScript for appending.\n";
+ open(FHW, '>>', $IntAutoScript) or die "Unable to open the file, $IntAutoScript for appending.\n";
seek(FHW, 0, 2); # seek to the end of the file.
# Write into the intermediary auto script.
show_results process_options files_to_modules
finish_tap_output
reload_manifest);
-$VERSION = 0.11;
+$VERSION = 0.12;
require Exporter;
$manifest_path = "../MANIFEST";
}
- if (open(my $manfh, $manifest_path )) {
+ if (open(my $manfh, '<', $manifest_path )) {
while (<$manfh>) {
if (/^(\S+)/) {
$MANIFEST{$1}++;
### update the manifest
{ my $file = $Repo . '/MANIFEST';
my @manifest;
- { open my $fh, "<$file" or die "Could not open $file: $!";
+ { open my $fh, '<', $file or die "Could not open $file: $!";
@manifest = <$fh>;
close $fh;
}
push @manifest, values %pkg_files;
{ chmod 0644, $file;
- open my $fh, ">$file" or die "Could not open $file for writing: $!";
+ open my $fh, '>', $file or die "Could not open $file for writing: $!";
#print $fh sort { lc $a cmp lc $b } @manifest;
### XXX stolen from pod/buildtoc:sub do_manifest
print $fh
my %dir;
-if (open(MANIFEST, "MANIFEST")) {
+if (open(MANIFEST, '<', 'MANIFEST')) {
while (<MANIFEST>) {
chomp;
s/\s.+//;
return unless (@authors);
my (%count, %raw);
foreach my $filename (@authors) {
- open FH, "<$filename" or die "Can't open $filename: $!";
+ open FH, '<', $filename or die "Can't open $filename: $!";
binmode FH, ':encoding(UTF-8)';
while (<FH>) {
next if /^\#/;
jbuehler\100hekimian.com jhpb\100hekimian.com
jcromie\100100divsol.com jcromie\100cpan.org
+ jim.cromie\100gmail.com
+jd\100cpanel.net lightsey\100debian.org
jdhedden\100cpan.org jerry\100hedden.us
+ jdhedden\1001979.usna.com
+ jdhedden\100gmail.com
my $result;
- open(FH,$parsefile) or warn "Could not open '$parsefile': $!";
+ open(FH,'<',$parsefile) or warn "Could not open '$parsefile': $!";
my $inpod = 0;
while (<FH>) {
find(sub {
/\.([ch]|xs)$/ or return;
- my $fh = IO::File->new($_) or die "$_: $!\n";
+ my $fh = IO::File->new($_, 'r') or die "$_: $!\n";
my $ll = '';
while (defined(my $line = <$fh>)) {
print STDERR "$0: Looking for symbols...\n";
for my $pat (@PAT) {
for my $fn (map { glob($_) } @{ $pat->[0] }) {
- if (open(my $fh, $fn)) {
+ if (open(my $fh, '<', $fn)) {
while (<$fh>) {
for my $p (@$pat) {
for my $sym (/$p/g) {
my $SYM = join("|", sort { length($b) <=> length($a) || $a cmp $b } keys %SYM);
-open(my $mani, "MANIFEST") or die "$0: Failed to open MANIFEST\n";
+open(my $mani, '<', "MANIFEST") or die "$0: Failed to open MANIFEST\n";
my %found;
while (<$mani>) {
# from metaconfig generated files that refer to
# the config symbols, and from pods.
next if $fn =~ m{^(?:config_h.SH|Configure|configure\.com|Porting/(?:config|Glossary)|(?:NetWare|plan9|win32)/(?:config|(?:GNU)?[Mm]akefile)|uconfig)|\.pod$};
- open my $fh, $fn or die qq[$0: Failed to open $fn: $!];
+ open my $fh, '<', $fn or die qq[$0: Failed to open $fn: $!];
while (<$fh>) {
while (/\b($SYM)\b/go) {
$found{$1}{$fn}++;
use warnings;
my ($cSH, $ch, @ch, %ch) = ("config_h.SH");
-open $ch, "<$cSH" or die "Cannot open $cSH: $!\n";
+open $ch, '<', $cSH or die "Cannot open $cSH: $!\n";
{ local $/ = "\n\n";
@ch = <$ch>;
close $ch;
push @ch, ";;\nesac\n";
-open $ch, "> $cSH" or die "Cannot write $cSH: $!\n";
+open $ch, '>', $cSH or die "Cannot write $cSH: $!\n";
print $ch <<EOW;
#!/bin/sh
#
# Load the package details. All of them.
my %cpanversions;
-open my $fh, $packagefile or die $!;
+open my $fh, '<', $packagefile or die $!;
while (<$fh>) {
my ($p, $v) = split ' ';
next if 1../^\s*$/; # skip header
=~ s/\0/'."\\0".'/grid;
$prog = <<end;
open oUt, ">&", STDOUT;
- open STDOUT, ">/dev/null";
- open STDIN, "</dev/null";
- open STDERR, ">/dev/null";
+ open STDOUT, ">", "/dev/null";
+ open STDIN, "<", "/dev/null";
+ open STDERR, ">", "/dev/null";
\$unused_variable = '$q';
eval \$unused_variable while \$also_unused++ < 4;
print oUt sv_count, "\n";
die "Must be in root of the perl source tree.\n"
unless -f "./MANIFEST" and -f "patchlevel.h";
-open PATCHLEVEL,"<patchlevel.h" or die;
+open PATCHLEVEL, '<', 'patchlevel.h' or die;
my @patchlevel_h = <PATCHLEVEL>;
close PATCHLEVEL;
my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h;
use warnings;
use File::Find;
-open my $fh, 'MANIFEST' or die "Can't read MANIFEST: $!\n";
+open my $fh, '<', 'MANIFEST' or die "Can't read MANIFEST: $!\n";
my @files = map { (split)[0] } <$fh>;
close $fh;
for (@files) {
# ensure 'make' will update all files
my $t= time;
for my $file (find_type_f($new_dir)) {
- open(my $fh,">>$file") || die "Cannot write $file:$!";
+ open(my $fh,'>>',$file) || die "Cannot write $file:$!";
close($fh);
utime($t,$t,$file);
};
while (my $line = <$fh>) {
next unless my ($file) = $line =~ /^(\S+\.[ch])\t/;
- open F, "< $file" or die "Cannot open $file for docs: $!\n";
+ open F, '<', $file or die "Cannot open $file for docs: $!\n";
$curheader = "Functions in file $file\n";
autodoc(\*F,$file);
close F or die "Error closing $file: $!\n";
#endif /* defined(PERL_IN_REGEXEC_C) */
/* Generated from:
- * f1951e655fd5fa35478f641663ef164146d743362998b01378327afac5f20270 lib/Unicode/UCD.pm
+ * 59e717586b720a821ee0d7397679d5322e38b49f6fb7840545aedf669c733b70 lib/Unicode/UCD.pm
* 47cb62a53beea6d0263e2147331c7e751853c9327225d95bbe2d9e1dc3e1aa44 lib/unicore/ArabicShaping.txt
* 153f0a100c315f9f3945e78f57137611d36c44b3a975919c499fd403413fede8 lib/unicore/BidiBrackets.txt
* fbe806975c1bf9fc9960bbaa39ff6290c42c7da8315f9cd459109b024cc1c485 lib/unicore/BidiMirroring.txt
* 066d6e75f95cf6794161c8ac0b1a40990277de90eefb913be2e675a7cba38d59 lib/unicore/mktables
* cdecb300baad839a6f62791229f551a4fa33f3cbdca08e378dc976466354e778 lib/unicore/version
* 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
- * 6697977221bf632720408ca9a1a934e43d5d8e51c870532cec3ebdb3e3ba80c6 regen/mk_invlists.pl
+ * ed40040566a4f1d6b0d912dda2159c1460e0093b318d90626ab9aa513a53b15d regen/mk_invlists.pl
* ex: set ro: */
my %seen_quotes;
{
my ($name, $val);
- open(CONFIG_SH, $Config_SH) || die "Can't open $Config_SH: $!";
+ open(CONFIG_SH, '<', $Config_SH) || die "Can't open $Config_SH: $!";
while (<CONFIG_SH>) {
next if m:^#!/bin/sh:;
# copy config summary format from the myconfig.SH script
$heavy_txt .= "our \$summary = <<'!END!';\n";
-open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
+open(MYCONFIG,'<','myconfig.SH') || die "open myconfig.SH failed: $!";
1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
do { $heavy_txt .= $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
close(MYCONFIG);
$heavy_txt .= "${prefix}_nolargefiles='$value'\n";
}
-if (open(my $fh, "cflags")) {
+if (open(my $fh, '<', 'cflags')) {
my $ccwarnflags;
my $ccstdflags;
while (<$fh>) {
ENDOFTIE
-open(CONFIG_POD, ">$Config_POD") or die "Can't open $Config_POD: $!";
+open(CONFIG_POD, '>', $Config_POD) or die "Can't open $Config_POD: $!";
print CONFIG_POD <<'ENDOFTAIL';
=head1 NAME
ENDOFTAIL
if ($Opts{glossary}) {
- open(GLOS, "<$Glossary") or die "Can't open $Glossary: $!";
+ open(GLOS, '<', $Glossary) or die "Can't open $Glossary: $!";
}
my %seen = ();
my $text = 0;
@ISA = qw(SelfLoader);
@EXPORT = 'AUTOLOAD';
$JUST_STUBS = 1;
-$VERSION = 1.05;
+$VERSION = 1.06;
sub Version {$VERSION}
# Use as
my (@BEFORE_DATA, @AFTER_DATA, @AFTER_END);
@DATA = @STUBS = ();
- open($fh,$mod_file) || die "Unable to open $mod_file";
+ open($fh,'<',$mod_file) || die "Unable to open $mod_file";
local $/ = "\n";
while(defined ($line = <$fh>) and $line !~ m/^__DATA__/) {
push(@BEFORE_DATA,$line);
my $f = $1;
my $file = catfile(curdir(),$inlib,$f);
push @cleanup, $file;
- open FH, ">$file" or die $!;
+ open FH, '>', $file or die $!;
} else {
print FH;
}
{
my $file = "A-$$";
push @cleanup, $file;
- open FH, ">$file" or die $!;
+ open FH, '>', $file or die $!;
select FH;
Devel::SelfStubber->stub('xChild', $inlib);
select STDOUT;
print "ok 1\n";
close FH or die $!;
- open FH, $file or die $!;
+ open FH, '<', $file or die $!;
my @A = <FH>;
if (@A == 1 && $A[0] =~ /^\s*sub\s+xChild::foo\s*;\s*$/) {
{
my $file = "B-$$";
push @cleanup, $file;
- open FH, ">$file" or die $!;
+ open FH, '>', $file or die $!;
select FH;
Devel::SelfStubber->stub('Proto', $inlib);
select STDOUT;
print "ok 3\n"; # Checking that we did not die horribly.
close FH or die $!;
- open FH, $file or die $!;
+ open FH, '<', $file or die $!;
my @B = <FH>;
if (@B == 1 && $B[0] =~ /^\s*sub\s+Proto::bar\s*\(\$\$\);\s*$/) {
{
my $file = "C-$$";
push @cleanup, $file;
- open FH, ">$file" or die $!;
+ open FH, '>', $file or die $!;
select FH;
Devel::SelfStubber->stub('Attribs', $inlib);
select STDOUT;
print "ok 5\n"; # Checking that we did not die horribly.
close FH or die $!;
- open FH, $file or die $!;
+ open FH, '<', $file or die $!;
my @C = <FH>;
if (@C == 2 && $C[0] =~ /^\s*sub\s+Attribs::baz\s+:\s*locked\s*;\s*$/
foreach my $module (@module) {
my $file = "$module--$$";
push @cleanup, $file;
- open FH, ">$file" or die $!;
+ open FH, '>', $file or die $!;
print FH "use $module;
print ${module}->foo;
";
foreach my $module (@module, 'Data', 'End') {
my $file = catfile(curdir(),$lib,"$module.pm");
my $fileo = catfile(curdir(),$inlib,"$module.pm");
- open FH, $fileo or die "Can't open $fileo: $!";
+ open FH, '<', $fileo or die "Can't open $fileo: $!";
my $contents = <FH>;
close FH or die $!;
push @cleanup, $file;
- open FH, ">$file" or die $!;
+ open FH, '>', $file or die $!;
select FH;
if ($contents =~ /__DATA__/) {
# This will die for any module with no __DATA__
system "$runperl -w \"-I$lib\" \"-MEnd\" -e \"End::lime\"";
# But check that the documentation after the __END__ survived.
-open FH, catfile(curdir(),$lib,"End.pm") or die $!;
+open FH, '<', catfile(curdir(),$lib,"End.pm") or die $!;
$_ = <FH>;
close FH or die $!;
'dumped glob for %baz fine' );
SKIP: {
- skip( "Couldn't open $0 for reading", 1 ) unless open(FILE, $0);
+ skip( "Couldn't open $0 for reading", 1 ) unless open(FILE, '<', $0);
my $fileno = fileno(FILE);
$d->dumpglob( '', 0, 'FILE', *FILE );
is( $out->read, "FileHandle(FILE) => fileno($fileno)\n",
$source_file = File::Spec->catfile('t', 'basict.c');
{
local *FH;
- open FH, "> $source_file" or die "Can't create $source_file: $!";
+ open FH, '>', $source_file or die "Can't create $source_file: $!";
print FH "int boot_basict(void) { return 1; }\n";
close FH;
}
$source_file = File::Spec->catfile('t', 'linkt.c');
{
- open my $FH, "> $source_file" or die "Can't create $source_file: $!";
+ open my $FH, '>', $source_file or die "Can't create $source_file: $!";
print $FH "int main(void) { return 11; }\n";
close $FH;
}
$source_file = File::Spec->catfile('t', 'cplust.cc');
{
- open my $FH, "> $source_file" or die "Can't create $source_file: $!";
+ open my $FH, '>', $source_file or die "Can't create $source_file: $!";
print $FH "class Bogus { public: int boot_cplust() { return 1; } };\n";
close $FH;
}
);
%EXPORT_TAGS = ('ALL' => \@EXPORT_OK);
-$VERSION = "0.41";
+$VERSION = "0.42";
sub uniq { my %seen; return grep(!($seen{$_}++), @_); } # a util function
So far so good. But suppose the way you're implementing this is:
my %greetings;
- die unless open(IN, "<in.dat");
+ die unless open(IN, "<", "in.dat");
while(<IN>) {
chomp;
next unless /^([^=]+)=(.+)/s;
use I18N::LangTags qw(encode_language_tag);
my %greetings;
- die unless open(IN, "<in.dat");
+ die unless open(IN, "<", "in.dat");
while(<IN>) {
chomp;
next unless /^([^=]+)=(.+)/s;
}
if ($] < 5.008 and !$PERL_CORE) {
- open(FH,">typemap");
+ open(FH,'>','typemap');
print FH "const char * T_PV\n";
close(FH);
}
my $flag;
if ( -d $fakedir or mkpath( $fakedir ))
{
- if (open( OUT, ">$fakemod"))
+ if (open( OUT, '>', $fakemod ))
{
(my $package = <<' END_HERE') =~ tr/\t//d;
package IO::fakemod;
ok(!defined($dot->read));
}
-open(FH,'>X') || die "Can't create x";
+open(FH,'>','X') || die "Can't create x";
print FH "X";
close(FH) or die "Can't close: $!";
### use standard open to make sure we can compare binmodes
### on both.
{ my $tmp;
- open $tmp, ">$File" or die "Could not open '$File': $!";
+ open $tmp, '>', $File or die "Could not open '$File': $!";
binmode $tmp;
print $tmp $All_Chars;
close $tmp;
my $t;
-open (F, $File) or die $!;
+open (F, '<', $File) or die $!;
my $io = IO::File->new($File) or die $!;
<F> for (1 .. 10);
### the client. We'll use own source code ...
#
local @data;
-if( !open( SRC, "< $0")) {
+if( !open( SRC, '<', $0)) {
print "not ok 15 - $!\n";
} else {
@data = <SRC>;
}
# Test if we can create the file within the tmp directory
-if (-e $PATH or not open(TEST, ">$PATH") and $^O ne 'os2') {
+if (-e $PATH or not open(TEST, '>', $PATH) and $^O ne 'os2') {
print "1..0 # Skip: cannot open '$PATH' for write\n";
exit 0;
}
$! = 0;
my $nosuch = '/non/existent/file.name';
-open(NOSUCH, $nosuch);
+open(NOSUCH, '<', $nosuch);
if ($@) {
my $errno = $!;
die "Eek! Attempting to open $nosuch failed, but \$! is still 0" unless $!;
use Tie::Handle; # loads Tie::StdHandle
use Search::Dict;
-open(DICT, "+>dict-$$") or die "Can't create dict-$$: $!";
+open(DICT, '+>', "dict-$$") or die "Can't create dict-$$: $!";
binmode DICT; # To make length expected one.
print DICT $DICT;
use vars qw($canonical $forgive_me $VERSION);
-$VERSION = '2.59';
+$VERSION = '2.60';
BEGIN {
if (eval {
my $file = shift;
my $fh = IO::File->new;
- open($fh, "<". $file) || die "Can't open '$file': $!";
+ open($fh, "<", $file) || die "Can't open '$file': $!";
binmode($fh);
defined(sysread($fh, my $buf, 32)) || die "Can't read from '$file': $!";
close($fh);
logcroak "wrong argument number" unless @_ == 2; # No @foo in arglist
local *FILE;
if ($use_locking) {
- open(FILE, ">>$file") || logcroak "can't write into $file: $!";
+ open(FILE, '>>', $file) || logcroak "can't write into $file: $!";
unless (&CAN_FLOCK) {
logcarp
"Storable::lock_store: fcntl/flock emulation broken on $^O";
truncate FILE, 0;
# Unlocking will happen when FILE is closed
} else {
- open(FILE, ">$file") || logcroak "can't create $file: $!";
+ open(FILE, '>', $file) || logcroak "can't create $file: $!";
}
binmode FILE; # Archaic systems...
my $da = $@; # Don't mess if called from exception handler
sub _retrieve {
my ($file, $use_locking) = @_;
local *FILE;
- open(FILE, $file) || logcroak "can't open $file: $!";
+ open(FILE, '<', $file) || logcroak "can't open $file: $!";
binmode FILE; # Archaic systems...
my $self;
my $da = $@; # Could be from exception handler
\&dclone, # XS function
- sub { open FOO, "/" },
+ sub { open FOO, '<', "/" },
);
$Storable::Deparse = 1;
my $devnull = File::Spec->devnull;
open(SAVEERR, ">&STDERR");
- open(STDERR, ">$devnull") or
+ open(STDERR, '>', $devnull) or
( print SAVEERR "Unable to redirect STDERR: $!\n" and exit(1) );
eval { $freezed = freeze $obj[0]->[0] };
for my $dump (@dumps) {
$testno++;
- open(FH, ">$file") || die "Can't create $file: $!";
+ open(FH, '>', $file) || die "Can't create $file: $!";
binmode(FH);
print FH $dump;
close(FH) || die "Can't write $file: $!";
package foo;
sub new { return bless {} }
DESTROY {
- open FH, "<foo" or die $!;
+ open FH, '<', "foo" or die $!;
eval { Storable::pretrieve(*FH); };
close FH or die $!;
unlink "foo";
for my $test (@tests) {
my($data, $expected) = @$test;
- open(FH, ">$file") || die "Can't create $file: $!";
+ open(FH, '>', $file) || die "Can't create $file: $!";
binmode(FH);
print FH $data;
close(FH) || die "Can't write $file: $!";
my $devnull = File::Spec->devnull;
open(SAVEERR, ">&STDERR");
-open(STDERR, ">$devnull") or
+open(STDERR, '>', $devnull) or
( print SAVEERR "Unable to redirect STDERR: $!\n" and exit(1) );
eval {$result = store ($bad , 'store')};
sub slurp {
my $file = shift;
local (*FH, $/);
- open FH, "<$file" or die "Can't open '$file': $!";
+ open FH, '<', $file or die "Can't open '$file': $!";
binmode FH;
my $contents = <FH>;
die "Can't read $file: $!" unless defined $contents;
sub store_and_retrieve {
my $data = shift;
unlink $file or die "Can't unlink '$file': $!";
- open FH, ">$file" or die "Can't open '$file': $!";
+ open FH, '>', $file or die "Can't open '$file': $!";
binmode FH;
print FH $data or die "Can't print to '$file': $!";
close FH or die "Can't close '$file': $!";
return eval {thaw $data};
}
-$file;
+1;
# the Windows CONIN$ needs GENERIC_WRITE mode to allow
# a SetConsoleMode() if we end up using Term::ReadKey
- open FIN, ( $^O eq 'MSWin32' && $console eq 'CONIN$' ) ? "+<$console" :
- "<$console";
- open FOUT,">$consoleOUT";
+ open FIN, (( $^O eq 'MSWin32' && $console eq 'CONIN$' ) ? '+<' : '<' ), $console;
+ open FOUT,'>', $consoleOUT;
#OUT->autoflush(1); # Conflicts with debugger?
my $sel = select(FOUT);
package Term::ReadLine; # So late to allow the above code be defined?
-our $VERSION = '1.15';
+our $VERSION = '1.16';
my ($which) = exists $ENV{PERL_RL} ? split /\s+/, $ENV{PERL_RL} : undef;
if ($which) {
$planned = 0;
}
-$VERSION = '1.29';
+$VERSION = '1.30';
require Exporter;
@ISA=('Exporter');
my($file) = shift;
return unless defined $file and length $file
and -e $file and -f _ and -r _;
- open(SOURCEFILE, "<$file") || return;
+ open(SOURCEFILE, '<', $file) || return;
$Program_Lines{$file} = [<SOURCEFILE>];
close(SOURCEFILE);
as the value for comparing. For example:
ok sub {
- open(OUT, ">x.dat") || die $!;
+ open(OUT, '>', 'x.dat') || die $!;
print OUT "\x{e000}";
close OUT;
my $bytecount = -s 'x.dat';
if (close($got_fh) && close($exp_fh)) {
my $diff_cmd = "$diff $exp_filename $got_filename";
print $TESTERR "#\n# $prefix $diff_cmd\n";
- if (open(DIFF, "$diff_cmd |")) {
+ if (open(DIFF, '-|', $diff_cmd)) {
local $_;
while (<DIFF>) {
print $TESTERR "# $prefix $_";
### seeing the todo tests, otherwise you get people sending in bug reports
### about Test.pm having "UNEXPECTEDLY SUCCEEDED" tests.
-open F, ">mix";
+open F, ">", "mix";
$TESTOUT = *F{IO};
$TESTERR = *F{IO};
$TESTERR = *STDERR{IO};
$ntest = 1;
-open F, "mix";
+open F, "<", "mix";
my $out = join '', <F>;
close F;
unlink "mix";
my $why = "zero != one";
# sneak in a test that Test::Harness wont see
-open J, ">junk";
+open J, ">", "junk";
$TESTOUT = *J{IO};
$TESTERR = *J{IO};
ok(0, 1, $why);
### seeing the todo tests, otherwise you get people sending in bug reports
### about Test.pm having "UNEXPECTEDLY SUCCEEDED" tests.
-open F, ">todo";
+open F, ">", "todo";
$TESTOUT = *F{IO};
$TESTERR = *F{IO};
my $tests = 5;
$TESTERR = *STDERR{IO};
$ntest = 1;
-open F, "todo";
+open F, "<", "todo";
my $out = join '', <F>;
close F;
unlink "todo";
my $x = join $:, @c, '';
local *FH = $o->{fh};
seek FH, 0, SEEK_SET;
-# my $open = open FH, "< $file";
+# my $open = open FH, "<", $file;
my $a;
{ local $/; $a = <FH> }
$a = "" unless defined $a;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
print "ok $N\n"; $N++;
# 2-3 FETCHSIZE 0-length file
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
close F;
$o = tie @a, 'Tie::File', $file;
untie @a;
my $data = "rec0$:rec1$:rec2$:";
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
sub setup_badly_terminated_file {
my $NTESTS = shift;
- open F, "> $file" or die "Couldn't open $file: $!";
+ open F, '>', $file or die "Couldn't open $file: $!";
binmode F;
print F $badrec;
close F;
sub setup_badly_terminated_file {
my $NTESTS = shift;
- open F, "> $file" or die "Couldn't open $file: $!";
+ open F, '>', $file or die "Couldn't open $file: $!";
binmode F;
print F $badrec;
close F;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
print "ok $N\n"; $N++;
# 2-3 FETCHSIZE 0-length file
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
close F;
$o = tie @a, 'Tie::File', $file, recsep => 'blah';
print $o ? "ok $N\n" : "not ok $N\n";
untie @a;
# 4-5 FETCHSIZE positive-length file
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
print F $data;
close F;
$o = tie @a, 'Tie::File', $file, recsep => 'blah';
print "ok $N\n"; $N++;
# 2-4 Who the heck knows?
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
close F;
$o = tie @a, 'Tie::File', $file, recsep => 'blah';
print $o ? "ok $N\n" : "not ok $N\n";
my $x = join $:, @c, '';
local *FH = $o->{fh};
seek FH, 0, SEEK_SET;
-# my $open = open FH, "< $file";
+# my $open = open FH, '<', $file;
my $a;
{ local $/; $a = <FH> }
$a = "" unless defined $a;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
@a = qw(fish dog carrot);
undef $o;
untie @a;
-open F, "< $file" or die "Couldn't open file $file: $!";
+open F, '<', $file or die "Couldn't open file $file: $!";
binmode F;
my $a = do {local $/ ; <F> };
my $x = "fish\r\ndog\r\ncarrot\r\n" ;
my $x = join $:, @c, '';
local *FH = $o->{fh};
seek FH, 0, SEEK_SET;
-# my $open = open FH, "< $file";
+# my $open = open FH, '<', $file;
my $a;
{ local $/; $a = <FH> }
$a = "" unless defined $a;
sub init_file {
my $data = shift;
- open F, "> $file" or die $!;
+ open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
my $x = join $:, @c, '';
local *FH = $o->{fh};
seek FH, 0, SEEK_SET;
-# my $open = open FH, "< $file";
+# my $open = open FH, '<', $file;
my $a;
{ local $/; $a = <FH> }
$a = "" unless defined $a;
# The problem was premature termination in the inner loop
# because you had $more_data scoped *inside* the block instead of outside.
# 20020331
-open F, "> $file" or die "Couldn't open $file: $!";
+open F, '>', $file or die "Couldn't open $file: $!";
binmode F;
for (1..100) {
print F "$_ ", 'a'x150, $: ;
sub try {
my ($pos, $len, $newlen) = @_;
- open F, "> $file" or die "Couldn't open file $file: $!";
+ open F, '>', $file or die "Couldn't open file $file: $!";
binmode F;
# The record has exactly 17 characters. This will help ensure that
$o->_twrite($newdata, $pos, $len);
undef $o; untie @lines;
- open F, "< $file" or die "Couldn't open file $file: $!";
+ open F, '<', $file or die "Couldn't open file $file: $!";
binmode F;
my $actual;
{ local $/;
my $x = join $:, @c, '';
local *FH = $o->{fh};
seek FH, 0, SEEK_SET;
-# my $open = open FH, "< $file";
+# my $open = open FH, '<', $file;
my $a;
{ local $/; $a = <FH> }
$a = "" unless defined $a;
my ($s, $len, $newlen) = @_;
my $e = $s + $len;
- open F, "> $file" or die "Couldn't open file $file: $!";
+ open F, '>', $file or die "Couldn't open file $file: $!";
binmode F;
print F $oldfile;
my $actual_return = $o->_iwrite($newdata, $s, $e);
undef $o; untie @lines;
- open F, "< $file" or die "Couldn't open file $file: $!";
+ open F, '<', $file or die "Couldn't open file $file: $!";
binmode F;
my $actual;
{ local $/;
sub try {
push @TRIES, [@_] if @_ == 3;
- open F, "> $file" or die "Couldn't open file $file: $!";
+ open F, '>', $file or die "Couldn't open file $file: $!";
binmode F;
print F $oldfile;
close F;
my $actual_return = $o->_mtwrite(@mt_args);
undef $o; untie @lines;
- open F, "< $file" or die "Couldn't open file $file: $!";
+ open F, '<', $file or die "Couldn't open file $file: $!";
binmode F;
my $actual;
{ local $/;
sub try {
my ($pos, $len, $newlen) = @_;
- open F, "> $file" or die "Couldn't open file $file: $!";
+ open F, '>', $file or die "Couldn't open file $file: $!";
binmode F;
# The record has exactly 17 characters. This will help ensure that
}
}
- open F, "< $file" or die "Couldn't open file $file: $!";
+ open F, '<', $file or die "Couldn't open file $file: $!";
binmode F;
my $actual;
{ local $/;
my $x = join $:, @c, '';
local *FH = $o->{fh};
seek FH, 0, SEEK_SET;
-# my $open = open FH, "< $file";
+# my $open = open FH, '<', $file;
my $a;
{ local $/; $a = <FH> }
$a = "" unless defined $a;
sub try {
my ($src, $dst, $len) = @_;
- open F, "> $file" or die "Couldn't open file $file: $!";
+ open F, '>', $file or die "Couldn't open file $file: $!";
binmode F;
# The record has exactly 17 characters. This will help ensure that
}
}
- open F, "< $file" or die "Couldn't open file $file: $!";
+ open F, '<', $file or die "Couldn't open file $file: $!";
binmode F;
my $actual;
{ local $/;
my $x = join $:, @c, '';
local *FH = $o->{fh};
seek FH, 0, SEEK_SET;
-# my $open = open FH, "< $file";
+# my $open = open FH, '<', $file;
my $a;
{ local $/; $a = <FH> }
$a = "" unless defined $a;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
#
undef $o; untie @a;
$data = join "$:", map("record$_", 0..7), ""; # records are 8 or 9 bytes long
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
undef $o;
untie @a;
# (79) We can't use check_contents any more, because the object is dead
-open F, "< $file" or die;
+open F, '<', $file or die;
binmode F;
{ local $/ ; $z = <F> }
close F;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
use Tie::File;
print "ok $N\n"; $N++;
-open F, "> $file" or die $!;
+open F, '>', $file or die $!;
binmode F;
print F $data;
close F;
my $obj_ext = $Config{obj_ext} || ".o";
unlink("$tmp.c", "$tmp$obj_ext");
- if (open(TMPC, ">$tmp.c")) {
+ if (open(TMPC, '>', "$tmp.c")) {
print TMPC $c;
close(TMPC);
unless defined $cccmd;
if ($^O eq 'VMS') {
- open( CMDFILE, ">$tmp.com" );
+ open( CMDFILE, '>', "$tmp.com" );
print CMDFILE "\$ SET MESSAGE/NOFACILITY/NOSEVERITY/NOIDENT/NOTEXT\n";
print CMDFILE "\$ $cccmd\n";
print CMDFILE "\$ IF \$SEVERITY .NE. 1 THEN EXIT 44\n"; # escalate
if ($DEFINE) {
$DEFINE =~ s/^\s+//;
- if (open(XDEFINE, ">xdefine")) {
+ if (open(XDEFINE, '>', 'xdefine')) {
print XDEFINE $DEFINE, "\n";
close(XDEFINE);
}
foreach $file ('const-c.inc', 'const-xs.inc') {
my $fallback = File::Spec->catfile('fallback', $file);
local $/;
- open IN, "<$fallback" or die "Can't open $fallback: $!";
- open OUT, ">$file" or die "Can't open $file: $!";
+ open IN, '<', $fallback or die "Can't open $fallback: $!";
+ open OUT, '>', $file or die "Can't open $file: $!";
print OUT <IN> or die $!;
close OUT or die "Can't close $file: $!";
close IN or die "Can't close $fallback: $!";
DEFINE('SELECT_IS_BROKEN');
$LIBS = [];
print "System is $^O, skipping full configure...\n";
- open(XDEFINE, ">xdefine") or die "$0: Cannot create xdefine: $!\n";
+ open(XDEFINE, '>', 'xdefine') or die "$0: Cannot create xdefine: $!\n";
close(XDEFINE);
} else {
init();
my $limit = 0.25; # 25% is acceptable slosh for testing timers
my $xdefine = '';
-if (open(XDEFINE, "xdefine")) {
+if (open(XDEFINE, "<", "xdefine")) {
chomp($xdefine = <XDEFINE> || "");
close(XDEFINE);
}
use Config;
my $xdefine = '';
-if (open(XDEFINE, "xdefine")) {
+if (open(XDEFINE, "<", "xdefine")) {
chomp($xdefine = <XDEFINE> || "");
close(XDEFINE);
}
my @mtime;
for (1..5) {
Time::HiRes::sleep(rand(0.1) + 0.1);
- open(X, ">$$");
+ open(X, '>', $$);
print X $$;
close(X);
my($a, $stat, $b) = ("a", [Time::HiRes::stat($$)], "b");
is $b, "b";
is_deeply $lstat, $stat;
Time::HiRes::sleep(rand(0.1) + 0.1);
- open(X, "<$$");
+ open(X, '<', $$);
<X>;
close(X);
$stat = [Time::HiRes::stat($$)];
my $targetname = "tgt$$";
my $linkname = "link$$";
SKIP: {
- open(X, ">$targetname");
+ open(X, '>', $targetname);
print X $$;
close(X);
eval { symlink $targetname, $linkname or die "can't symlink: $!"; };
sub getfstype {
my ($fn) = @_;
my $cmd = "df $fn";
- open(my $df, "$cmd |") or die "$cmd: $!";
+ open(my $df, '-|', $cmd) or die "$cmd: $!";
my @df = <$df>; # Assume $df[0] is header line.
my $dev = +(split(" ", $df[1]))[0];
- open(my $mounts, "/proc/mounts") or die "/proc/mounts: $!";
+ open(my $mounts, '<', '/proc/mounts') or die "/proc/mounts: $!";
while (<$mounts>) {
my @m = split(" ");
if ($m[0] eq $dev) { return $m[2] }
eval { require DynaLoader };
1 while unlink "XSLoader.pm";
-open OUT, ">XSLoader.pm" or die $!;
+open OUT, '>', 'XSLoader.pm' or die $!;
print OUT <<'EOT';
# Generated from XSLoader.pm.PL (resolved %Config::Config value)
# This file is unique for every OS
package XSLoader;
-$VERSION = "0.24";
+$VERSION = "0.26";
#use strict;
q(reverse split / /, $Config{inc_version_list});
}
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT,'>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
print OUT <<'!NO!SUBS!';
our @ORIG_INC = @INC; # take a handy copy of 'original' value
-our $VERSION = '0.63';
+our $VERSION = '0.64';
sub import {
shift;
mkpath [$Auto_Dir];
- open(MOD, ">$Module") || DIE $!;
+ open(MOD, '>', $Module) || DIE $!;
print MOD <<'MODULE';
package Yup;
$Plan = 9;
use Config;
-open (PERLM,"<perlmain.c") or die "Can't load perlmain.c: $!";
-open (MAKEFILE,"<makefile.pl") or die "Can't load makefile.pl: $!";
+open (PERLM, '<', 'perlmain.c') or die "Can't load perlmain.c: $!";
+open (MAKEFILE, '<', 'makefile.pl') or die "Can't load makefile.pl: $!";
undef $/;
$perlmain=<PERLM>;
$makefile=<MAKEFILE>;
#DynaLoader is special
$perlmain =~ s/(DynaLoader:\:boot)strap/$1_DynaLoader/gm;
-open (PERLM,">perlmain.c") or die "Can't write perlmain.c: $!";
+open (PERLM, '>', 'perlmain.c') or die "Can't write perlmain.c: $!";
print PERLM $perlmain;
package B::Xref;
-our $VERSION = '1.05';
+our $VERSION = '1.06';
=head1 NAME
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") {
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
# 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);
# 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;
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] }";
}
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;
# (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: $!";
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$$";
}
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
# Tim.Bunce@ig.co.uk, August 1994
BEGIN {
- $VERSION = '1.40';
+ $VERSION = '1.41';
}
EOT
use Config;
use strict;
-our $VERSION = "1.27";
+our $VERSION = "1.28";
my %err = ();
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();
# 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';
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;
$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') {
# create the CPP input
- open(CPPI,"> errno.c") or
+ open(CPPI, '>', 'errno.c') or
die "Cannot open errno.c";
if ($^O eq 'NetWare') {
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);
}
}
for (@f_names) {
- open T, "> $_";
+ open T, '>', $_;
close T;
}
next unless fileno($path);
print $path "$path 2\n";
close($path);
- open($path, $path);
+ open($path, '<', $path);
<$path>;
push @cat, <$path>;
close($path);
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 $!;
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 @_
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
-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);
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";
close($i);
}
-if (open(UTF, "<$utf")) {
+if (open(UTF, '<', $utf)) {
binmode(UTF, ":bytes");
# alpha beta gamma in UTF-8 Unicode (0x3b1 0x3b2 0x3b3)
close($i);
}
-if (open(GRK, "<$grk")) {
+if (open(GRK, '<', $grk)) {
binmode(GRK, ":bytes");
is(scalar <GRK>, "\xe1\xe2\xe3");
close GRK;
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);
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);
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,"€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);
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);
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>;
}
# result
- open my $in, $outfile or die "cannot open $outfile: $!";
+ open my $in, '<', $outfile or die "cannot open $outfile: $!";
$result = <$in>;
close $in;
}
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;
# Package globals
@ISA = ( 'DynaLoader' );
-$VERSION = '1.07';
+$VERSION = '1.08';
my(%Locsyms) = ( ':ID' => 'LOCAL' );
my(%Gblsyms) = ( ':ID' => 'GLOBAL');
my $DoCache = 1;
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 $_";
),
{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),/;
}
# 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>;
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]);
($iam = $0) =~ s%.*/%%;
$tmp = "$iam.$$";
-open (CODE,">$tmp.c") || die "$iam: cannot create $tmp.c: $!\n";
+open (CODE, '>', "$tmp.c") || die "$iam: cannot create $tmp.c: $!\n";
$mask = q/printf ("$sizeof{'%s'} = %d;\n"/;
printf STDERR "including %s\n", $include;
do $include;
warn "sourcing $include: $@\n" if ($@);
- if (!open (INCLUDE,"$LIB/$include")) {
+ if (!open (INCLUDE,'<',"$LIB/$include")) {
warn "can't open $LIB/$include: $!\n";
next;
}
# read in everything until what would have been the first =head
# directive, patching the index as we go.
- open(H, "<$file.html") ||
+ open(H, '<', "$file.html") ||
die "$0: error opening $file.html for input: $!\n";
$/ = "";
my @data = ();
close(H);
# now rewrite the file
- open(H, ">$file.html") ||
+ open(H, '>', "$file.html") ||
die "$0: error opening $file.html for output: $!\n";
print H "@data", "\n";
close(H);
my @files = sort(grep(/\.html?$/, readdir(DIR)));
closedir(DIR);
- open(HTML, ">$html") ||
+ open(HTML, '>', $html) ||
die "$0: error opening $html for output: $!\n";
# for each .html file in the directory, extract the index
foreach my $file (@files) {
my $filedata = do {
- open(my $in, "<$dir/$file") ||
+ open(my $in, '<', "$dir/$file") ||
die "$0: error opening $dir/$file for input: $!\n";
local $/ = undef;
<$in>;
# read the file in paragraphs
$/ = "";
- open(SPLITIN, "<$pod") ||
+ open(SPLITIN, '<', $pod) ||
die "$0: error opening $pod for input: $!\n";
@filedata = <SPLITIN>;
close(SPLITIN) ||
# create the new .pod file
print "\tcreating $poddir/$file\n" if $verbose;
- open(SPLITOUT, ">$poddir/$file") ||
+ open(SPLITOUT, '>', "$poddir/$file") ||
die "$0: error opening $poddir/$file for output: $!\n";
$poddata[$i] =~ s,L<([^<>]*)>,
defined $heads{anchorify($1)} ? "L<$dir/$1>" : "L<$1>"
{
my $filename = shift ;
my $content = shift;
- open F, ">$filename" or croak "Cannot open $filename: $!" ;
+ open F, '>', $filename or croak "Cannot open $filename: $!" ;
print F $content ;
close F;
}
{
my $filename = shift ;
my $content = shift;
- open F, ">DBM_Filter/$filename.pm" or croak "Cannot open $filename: $!" ;
+ open F, '>', "DBM_Filter/$filename.pm" or croak "Cannot open $filename: $!" ;
print F $content ;
close F;
$files{"DBM_Filter/$filename.pm"} ++;
if ($^O ne 'dos') {
pipe(IN, OUT);
} else {
- open(OUT, ">en.tmp");
+ open(OUT, ">", "en.tmp");
}
select(OUT);
$| = 1;
my $close = close OUT;
ok( !($close) == $CHILD_ERROR, '$CHILD_ERROR should be false' );
- open(IN, "<en.tmp") if ($^O eq 'dos');
+ open(IN, "<", "en.tmp") if ($^O eq 'dos');
my $foo = <IN>;
like( $foo, qr/ok 7/, '$OFS' );
eval { is( $EXCEPTIONS_BEING_CAUGHT, 1, '$EXCEPTIONS_BEING_CAUGHT' ) };
ok( !$EXCEPTIONS_BEING_CAUGHT, '$EXCEPTIONS_BEING_CAUGHT should be false' );
-eval { local *F; my $f = 'asdasdasd'; ++$f while -e $f; open(F, $f); };
+eval { local *F; my $f = 'asdasdasd'; ++$f while -e $f; open(F, '<', $f); };
is( $OS_ERROR, $ERRNO, '$OS_ERROR' );
ok( $OS_ERROR{ENOENT}, '%OS_ERROR (ENOENT should be set)' );
use strict;
# This is not a dual-life module, so no need for development version numbers
-$VERSION = '1.33';
+$VERSION = '1.34';
@ISA = qw(Exporter);
@EXPORT = qw(&xsinit &ldopts
push @archives, $archive;
if(-e ($extra = File::Spec->catdir($_,"auto",$root,"extralibs.ld"))) {
local(*FH);
- if(open(FH, $extra)) {
+ if(open(FH, '<', $extra)) {
my($libs) = <FH>; chomp $libs;
push @potential_libs, split /\s+/, $libs;
}
{
local $/; #slurp
my $fh;
- open($fh,$README);
+ open($fh,'<',$README);
binmode($fh);
my $data = <$fh>;
print $tfh $data;
}
# First we create a file
- open(F, ">file-$$") or die $!;
+ open(F, ">", "file-$$") or die $!;
binmode F; # for DOSISH platforms, because test 3 copies to stdout
printf F "ok\n";
close F;
copy "file-$$", "copy-$$";
- open(F, "copy-$$") or die $!;
+ open(F, "<", "copy-$$") or die $!;
my $foo = <F>;
close(F);
$TB->current_test($TB->current_test + 1);
unlink "copy-$$" or die "unlink: $!";
- open(F,"file-$$");
+ open(F, "<", "file-$$");
copy(*F, "copy-$$");
- open(R, "copy-$$") or die "open copy-$$: $!"; $foo = <R>; close(R);
+ open(R, "<", "copy-$$") or die "open copy-$$: $!"; $foo = <R>; close(R);
is $foo, "ok\n", 'copy(*F, fn): same contents';
unlink "copy-$$" or die "unlink: $!";
- open(F,"file-$$");
+ open(F, "<", "file-$$");
copy(\*F, "copy-$$");
close(F) or die "close: $!";
- open(R, "copy-$$") or die; $foo = <R>; close(R) or die "close: $!";
+ open(R, "<", "copy-$$") or die; $foo = <R>; close(R) or die "close: $!";
is $foo, "ok\n", 'copy(\*F, fn): same contents';
unlink "copy-$$" or die "unlink: $!";
binmode $fh or die $!;
copy("file-$$",$fh);
$fh->close or die "close: $!";
- open(R, "copy-$$") or die; $foo = <R>; close(R);
+ open(R, "<", "copy-$$") or die; $foo = <R>; close(R);
is $foo, "ok\n", 'copy(fn, io): same contents';
unlink "copy-$$" or die "unlink: $!";
binmode $fh or die $!;
copy("file-$$",$fh);
$fh->close;
- open(R, "copy-$$") or die $!; $foo = <R>; close(R);
+ open(R, "<", "copy-$$") or die $!; $foo = <R>; close(R);
is $foo, "ok\n", 'copy(fn, fh): same contents';
unlink "file-$$" or die "unlink: $!";
ok move("copy-$$", "file-$$"), 'move';
ok -e "file-$$", ' destination exists';
ok !-e "copy-$$", ' source does not';
- open(R, "file-$$") or die $!; $foo = <R>; close(R);
+ open(R, "<", "file-$$") or die $!; $foo = <R>; close(R);
is $foo, "ok\n", 'contents preserved';
TODO: {
# trick: create lib/ if not exists - not needed in Perl core
unless (-d 'lib') { mkdir 'lib' or die $!; }
copy "file-$$", "lib";
- open(R, "lib/file-$$") or die $!; $foo = <R>; close(R);
+ open(R, "<", "lib/file-$$") or die $!; $foo = <R>; close(R);
is $foo, "ok\n", 'copy(fn, dir): same contents';
unlink "lib/file-$$" or die "unlink: $!";
# Do it twice to ensure copying over the same file works.
copy "file-$$", "lib";
- open(R, "lib/file-$$") or die $!; $foo = <R>; close(R);
+ open(R, "<", "lib/file-$$") or die $!; $foo = <R>; close(R);
is $foo, "ok\n", 'copy over the same file works';
unlink "lib/file-$$" or die "unlink: $!";
}
move "file-$$", "lib";
- open(R, "lib/file-$$") or die "open lib/file-$$: $!"; $foo = <R>; close(R);
+ open(R, "<", "lib/file-$$") or die "open lib/file-$$: $!"; $foo = <R>; close(R);
is $foo, "ok\n", 'move(fn, dir): same contents';
ok !-e "file-$$", 'file moved indeed';
unlink "lib/file-$$" or die "unlink: $!";
SKIP: {
skip "Testing symlinks", 3 unless $Config{d_symlink};
- open(F, ">file-$$") or die $!;
+ open(F, ">", "file-$$") or die $!;
print F "dummy content\n";
close F;
symlink("file-$$", "symlink-$$") or die $!;
skip "Testing hard links", 3
if !$Config{d_link} or $^O eq 'MSWin32' or $^O eq 'cygwin';
- open(F, ">file-$$") or die $!;
+ open(F, ">", "file-$$") or die $!;
print F "dummy content\n";
close F;
link("file-$$", "hardlink-$$") or die $!;
unlink "file-$$" or die $!;
}
- open(F, ">file-$$") or die $!;
+ open(F, ">", "file-$$") or die $!;
binmode F;
print F "this is file\n";
close F;
my $copy_msg = "this is copy\n";
- open(F, ">copy-$$") or die $!;
+ open(F, ">", "copy-$$") or die $!;
binmode F;
print F $copy_msg;
close F;
}
is -s "copy-$$", length $copy_msg, "but does not truncate the destination";
- open(F, "copy-$$") or die $!;
+ open(F, "<", "copy-$$") or die $!;
$foo = <F>;
close(F);
is $foo, $copy_msg, "nor change the destination's contents";
TODO: {
local $TODO = 'spaces in filenames require DECC$EFS_CHARSET enabled' if $^O eq 'VMS';
- open(F, ">file-$$") or die $!;
+ open(F, ">", "file-$$") or die $!;
close F;
copy "file-$$", " copy-$$";
ok -e " copy-$$", "copy with leading whitespace";
SKIP: {
local *STAT;
- skip("Could not open file: $!", 2) unless open(STAT, $file);
+ skip("Could not open file: $!", 2) unless open(STAT, '<', $file);
isa_ok(File::stat::stat('STAT'), 'File::stat',
'... should be able to find filehandle');
use SelectSaver;
-open(FOO, ">foo-$$") || die;
+open(FOO, ">", "foo-$$") || die;
print "ok 1\n";
{
}
# Get data written to file
-open(FOO, "foo-$$") || die;
+open(FOO, "<", "foo-$$") || die;
chomp($foo = <FOO>);
close FOO;
unlink "foo-$$";
use Symbol;
$sym = gensym;
- open($sym, "filename");
+ open($sym, '<', "filename");
$_ = <$sym>;
# etc.
@EXPORT = qw(gensym ungensym qualify qualify_to_ref);
@EXPORT_OK = qw(delete_package geniosym);
-$VERSION = '1.07';
+$VERSION = '1.08';
my $genpkg = "Symbol::";
my $genseq = 0;
unlink("afile") if -f "afile";
-ok(open($f,"+>afile"), "open +>afile");
+ok(open($f, "+>", "afile"), "open +>, afile");
ok(open($f, "+<", "afile"), "open +<, afile");
ok(binmode($f), "binmode")
or diag("binmode: $!\n");
no warnings 'surrogate'; # surrogates can be inputs to this
use charnames ();
-our $VERSION = '0.67';
+our $VERSION = '0.68';
require Exporter;
for my $d (@INC) {
use File::Spec;
$f = File::Spec->catfile($d, "unicore", @path);
- last if open($$rfh, $f);
+ last if open($$rfh, '<', $f);
undef $f;
}
croak __PACKAGE__, ": failed to find ",
use Carp;
$Carp::Internal{__PACKAGE__.""}++;
-our $VERSION = '1.35';
+our $VERSION = '1.36';
our $DEBUG;
our $VERBOSE;
our $PRETTY;
$PRETTY = $opt_p;
}
- if (open(POD_DIAG, $PODFILE)) {
+ if (open(POD_DIAG, '<', $PODFILE)) {
warn "Happy happy podfile from real $PODFILE\n" if $DEBUG;
last CONFIG;
}
INCPATH: {
for my $file ( (map { "$_/".__PACKAGE__.".pm" } @INC), $0) {
warn "Checking $file\n" if $DEBUG;
- if (open(POD_DIAG, $file)) {
+ if (open(POD_DIAG, '<', $file)) {
while (<POD_DIAG>) {
next unless
/^__END__\s*# wish diag dbase were more accessible/;
sub txt_compare {
local $/;
my ($A, $B);
- for (($A,$B) = @_) { open(_,"<$_") ? $_ = <_> : die "$_ : $!"; close _ }
+ for (($A,$B) = @_) { open(_,"<",$_) ? $_ = <_> : die "$_ : $!"; close _ }
$A cmp $B;
}
plan tests => $total_tests;
-ok (open (HEADER, ">$header"), "open '$header'");
+ok (open (HEADER, '>', $header), "open '$header'");
print HEADER <<HEADER or die $!;
#define Camel 2
#define Dromedary 1
foreach my $leaf (File::Spec->catfile('lib', "$name.pm"), 'Makefile.PL') {
my $file = File::Spec->catfile($name, $leaf);
- if (ok (open (FILE, $file), "open $file")) {
+ if (ok (open (FILE, '<', $file), "open $file")) {
my $match = qr/use $version;/;
my $found;
while (<FILE>) {
use vars qw($VERSION $header);
# bump to X.XX in blead, only use X.XX_XX in maint
-$VERSION = '1.50';
+$VERSION = '1.51';
$header = "perl5db.pl version $VERSION";
$o = $i unless defined $o;
# read/write on in, or just read, or read on STDIN.
- open( IN, "+<$i" )
- || open( IN, "<$i" )
+ open( IN, '+<', $i )
+ || open( IN, '<', $i )
|| open( IN, "<&STDIN" );
# read/write/create/clobber out, or write/create/clobber out,
# or merge with STDERR, or merge with STDOUT.
- open( OUT, "+>$o" )
- || open( OUT, ">$o" )
+ open( OUT, '+>', $o )
+ || open( OUT, '>', $o )
|| open( OUT, ">&STDERR" )
|| open( OUT, ">&STDOUT" ); # so we don't dongle stdout
if ($tty) {
my ( $i, $o ) = split $tty, /,/;
$o = $i unless defined $o;
- open( IN, "<$i" ) or die "Cannot open TTY '$i' for read: $!";
- open( OUT, ">$o" ) or die "Cannot open TTY '$o' for write: $!";
+ open( IN, '<', $i ) or die "Cannot open TTY '$i' for read: $!";
+ open( OUT, '>', $o ) or die "Cannot open TTY '$o' for write: $!";
$IN = \*IN;
$OUT = \*OUT;
_autoflush($OUT);
}
# Open file onto the debugger's filehandles, if you can.
- open IN, $in or die "cannot open '$in' for read: $!";
- open OUT, ">$out" or die "cannot open '$out' for write: $!";
+ open IN, '<', $in or die "cannot open '$in' for read: $!";
+ open OUT, '>', $out or die "cannot open '$out' for write: $!";
# Swap to the new filehandles.
reset_IN_OUT( \*IN, \*OUT );
);
foreach (@tests) {
my ($why, $prog, $expect) = @$_;
- open P, ">$progfile" or die "Can't open '$progfile': $!";
+ open P, ">", $progfile or die "Can't open '$progfile': $!";
binmode(P, ":bytes") if $has_perlio;
print P $show, $prog, '; print $b'
or die "Print to 'progfile' failed: $!";
ok(($msg !~ /ABORT/),"vmsish ERR exit, vmsish hushed at runtime, DCL error message check");
local *TEST;
- open(TEST,'>vmsish_test.pl') || die('not ok ?? : unable to open "vmsish_test.pl" for writing');
+ open(TEST,'>','vmsish_test.pl') || die('not ok ?? : unable to open "vmsish_test.pl" for writing');
print TEST "#! perl\n";
print TEST "use vmsish qw(hushed);\n";
print TEST "\$obvious = (\$compile(\$error;\n";
# we create a file rather than using an existing one for the stat() test.
my $file = 'sys$scratch:vmsish_t_flirble.tmp';
- open TMP, ">$file" or die "Couldn't open file $file";
+ open TMP, '>', $file or die "Couldn't open file $file";
close TMP;
END { 1 while unlink $file; }
# they were turned off in invoking procedure
sub do_a_perl {
local *P;
- open(P,'>vmsish_test.com') || die('not ok ?? : unable to open "vmsish_test.com" for writing');
+ open(P,'>','vmsish_test.com') || die('not ok ?? : unable to open "vmsish_test.com" for writing');
print P "\$ set message/facil/sever/ident/text\n";
print P "\$ define/nolog/user sys\$error _nla0:\n";
print P "\$ $Invoke_Perl @_\n";
if (-f $makefile) {
$makefile_no_minus_f = 0;
- open my $mfh, $makefile or die "Cannot open $makefile: $!";
+ open my $mfh, '<', $makefile or die "Cannot open $makefile: $!";
while (<$mfh>) {
# Plagiarised from CPAN::Distribution
last if /MakeMaker post_initialize section/;
if ($ARGS{PLATFORM} eq 'os2') {
my (%mapped, @missing);
- open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
+ open MAP, '<', 'miniperl.map' or die 'Cannot read miniperl.map';
/^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
close MAP or die 'Cannot close miniperl.map';
#require AutoLoader;
our @ISA = qw(Exporter);
- our $VERSION = "1.11";
+ our $VERSION = "1.12";
XSLoader::load('OS2::Process', $VERSION);
}
close IN if defined $out;
$pid > 0 or die "Cannot start a grandkid";
- open STDIN, '</dev/con' or warn "reopen stdin: $!";
+ open STDIN, '<', '/dev/con' or warn "reopen stdin: $!";
select OUT; $| = 1; binmode OUT; # need binmode: sysread() may be bin
$SIG{PIPE} = sub { die "writing to a closed pipe" };
$SIG{HUP} = $SIG{BREAK} = $SIG{INT} = $SIG{TERM};
restores the screen given the result of screen(). E.g., if the file
C<$file> contains the screen contents, then
- open IN, $file or die;
+ open IN, '<', $file or die;
binmode IN;
read IN, $in, -s IN;
$s = screen;
#!perl
die "Usage: perl -x patchlevel.h comment ..." unless @ARGV;
-open PLIN, "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
-open PLOUT, ">patchlevel.new" or die "Couldn't write on patchlevel.new : $!";
+open PLIN, "<", "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
+open PLOUT, ">", "patchlevel.new" or die "Couldn't write on patchlevel.new : $!";
my $seen=0;
while (<PLIN>) {
if (/\t,NULL/ and $seen) {
# before the build
if ($ARGV[0] eq '-f') {
- open(ARGS,$ARGV[1]) or die "Can't read data from $ARGV[1]: $!\n";
+ open(ARGS,'<',$ARGV[1]) or die "Can't read data from $ARGV[1]: $!\n";
@ARGV = ();
while (<ARGS>) {
push(@ARGV,split(/\|/,$_));
EndOfGasp
}
$outdir = '';
-open(IN,"$infile") || die "Can't open $infile: $!\n";
-open(OUT,">${outdir}config.sh") || die "Can't open ${outdir}config.sh: $!\n";
+open(IN,'<',$infile) || die "Can't open $infile: $!\n";
+open(OUT,'>',"${outdir}config.sh") || die "Can't open ${outdir}config.sh: $!\n";
$time = localtime;
$cf_by = $ENV{'user'};
# Before we read the C header file, find out what config.sh constants are
# equivalent to the C preprocessor macros
-if (open(SH,"${outdir}config_h.SH")) {
+if (open(SH,'<',"${outdir}config_h.SH")) {
while (<SH>) {
next unless m%^#(?!if).*\$%;
s/^#//; s!(.*?)\s*/\*.*!$1!;
# print OUT "libs='",join(' ',@libs),"'\n";
# print OUT "libc='",join(' ',@crtls),"'\n";
-if (open(PL,"${outdir}patchlevel.h")) {
+if (open(PL,'<',"${outdir}patchlevel.h")) {
while (<PL>) {
if (/^#define PERL_VERSION\s+(\S+)/) {
print OUT "PERL_VERSION='$1'\n";
if (name($desc) ne $myname) {
$myname = name($desc);
print $myname, "\n";
- open(MAN, "> $myname.3pl");
+ open(MAN, '>', "$myname.3pl");
print MAN <<EOALL;
$header
.TH $myname 3PL "\\*(RP"
my $has_back = $body =~ /^=back/;
$body =~ s/^=over\s*//m if $has_over and !$has_back;
$body =~ s/^=back\s*//m if $has_back and !$has_over;
- open (POD, "> $name.pod") || die "can't open $name.pod: $!";
+ open (POD, '>', "$name.pod") || die "can't open $name.pod: $!";
print POD <<EOF;
\=head1 NAME
#endif /* H_REGCHARCLASS */
/* Generated from:
- * f1951e655fd5fa35478f641663ef164146d743362998b01378327afac5f20270 lib/Unicode/UCD.pm
+ * 59e717586b720a821ee0d7397679d5322e38b49f6fb7840545aedf669c733b70 lib/Unicode/UCD.pm
* 47cb62a53beea6d0263e2147331c7e751853c9327225d95bbe2d9e1dc3e1aa44 lib/unicore/ArabicShaping.txt
* 153f0a100c315f9f3945e78f57137611d36c44b3a975919c499fd403413fede8 lib/unicore/BidiBrackets.txt
* fbe806975c1bf9fc9960bbaa39ff6290c42c7da8315f9cd459109b024cc1c485 lib/unicore/BidiMirroring.txt
* 066d6e75f95cf6794161c8ac0b1a40990277de90eefb913be2e675a7cba38d59 lib/unicore/mktables
* cdecb300baad839a6f62791229f551a4fa33f3cbdca08e378dc976466354e778 lib/unicore/version
* 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
- * cd1fd94a77ea1ce1181f72c8333f9e5bd0cd790d6e8d1f460756a3f9f3f2762d regen/regcharclass.pl
+ * 1d27ae8b75d81a082b1fc594673e08540280f8169309a7b5047015c8091a2bfb regen/regcharclass.pl
* 393f8d882713a3ba227351ad0f00ea4839fda74fcf77dcd1cdf31519925adba5 regen/regcharclass_multi_char_folds.pl
* ex: set ro: */
my ($file, $pre) = @_;
local (*FILE, $_);
my %seen;
- open(FILE, "< $file")
+ open(FILE, '<', $file)
or die "embed.pl: Can't open $file: $!\n";
while (<FILE>) {
s/[ \t]*#.*//; # Delete comments.
sub setup_embed {
my $prefix = shift || '';
- open IN, $prefix . 'embed.fnc' or die $!;
+ open IN, '<', $prefix . 'embed.fnc' or die $!;
my @embed;
my %seen;
close IN or die "Problem reading embed.fnc: $!";
- open IN, $prefix . 'regen/opcodes' or die $!;
+ open IN, '<', $prefix . 'regen/opcodes' or die $!;
{
my %syms;
my $HintMask;
my $Uni8Bit;
-open "perl.h", "perl.h" or die "$0 cannot open perl.h: $!";
+open "perl.h", "<", "perl.h" or die "$0 cannot open perl.h: $!";
while (readline "perl.h") {
next unless /#\s*define\s+(HINT_FEATURE_MASK|HINT_UNI_8_BIT)/;
my $is_u8b = $1 =~ 8;
{
# Depend on mktables’ own sources. It’s a shorter list of files than
# those that Unicode::UCD uses.
- if (! open my $mktables_list, $sources_list) {
+ if (! open my $mktables_list, '<', $sources_list) {
# This should force a rebuild once $sources_list exists
push @sources, $sources_list;
my %seen;
my (@ops, %desc, %check, %ckname, %flags, %args, %opnum);
-open OPS, 'regen/opcodes' or die $!;
+open OPS, '<', 'regen/opcodes' or die $!;
while (<OPS>) {
chop;
}
# If given the -U option open up the metaconfig unit for this function.
- if ($opts{U} && open(U, ">d_${func}_r.U")) {
+ if ($opts{U} && open(U, ">", "d_${func}_r.U")) {
binmode U;
}
{
# Depend on mktables’ own sources. It’s a shorter list of files than
# those that Unicode::UCD uses.
- if (! open my $mktables_list, $sources_list) {
+ if (! open my $mktables_list, '<', $sources_list) {
# This should force a rebuild once $sources_list exists
push @sources, $sources_list;
my $old_fh= select($guts);
$~= "GuTS";
- open my $oldguts, "pod/perldebguts.pod"
+ open my $oldguts, '<', 'pod/perldebguts.pod'
or die "$0 cannot open pod/perldebguts.pod for reading: $!";
while (<$oldguts>) {
print;
if (-f $name) {
unlink $name or die "$name exists but can't unlink: $!";
}
- open $fh, ">$name" or die "Can't create $name: $!";
+ open $fh, '>', $name or die "Can't create $name: $!";
} elsif ($mode eq '>>') {
- open $fh, ">>$name" or die "Can't append to $name: $!";
+ open $fh, '>>', $name or die "Can't append to $name: $!";
} else {
die "Unhandled open mode '$mode'";
}
require Digest::SHA;
local ($/, *FH);
- open FH, "$file" or die "Can't open $file: $!";
+ open FH, '<', $file or die "Can't open $file: $!";
my $raw = <FH>;
close FH or die "Can't close $file: $!";
return Digest::SHA::sha256_hex($raw);
my $mmp = "$target.mmp";
my $targetpath = $miniperl
|| $perl ? "TARGETPATH\t\\System\\Apps\\Perl" : "";
- if ( open( my $fh, ">$mmp" ) ) {
+ if ( open( my $fh, '>', $mmp ) ) {
print "\t$mmp\n";
push @mmp, $mmp;
push @unclean, $mmp;
}
sub create_bld_inf {
- if ( open( BLD_INF, ">bld.inf" ) ) {
+ if ( open( BLD_INF, '>', 'bld.inf' ) ) {
print "\tbld.inf\n";
push @unclean, "bld.inf";
print BLD_INF <<__EOF__;
my %config;
sub load_config_sh {
- if ( open( CONFIG_SH, "symbian/config.sh" ) ) {
+ if ( open( CONFIG_SH, '<', 'symbian/config.sh' ) ) {
while (<CONFIG_SH>) {
if (/^(\w+)=['"]?(.*?)["']?$/) {
my ( $var, $val ) = ( $1, $2 );
sub create_config_h {
load_config_sh();
- if ( open( CONFIG_H, ">config.h" ) ) {
+ if ( open( CONFIG_H, '>', 'config.h' ) ) {
print "\tconfig.h\n";
push @unclean, "config.h";
- if ( open( CONFIG_H_SH, "config_h.SH" ) ) {
+ if ( open( CONFIG_H_SH, '<', 'config_h.SH' ) ) {
while (<CONFIG_H_SH>) {
last if /\#ifndef _config_h_/;
}
sub create_symbian_port_h {
print "\tsymbian\\symbian_port.h\n";
- if ( open( SYMBIAN_PORT_H, ">symbian/symbian_port.h" ) ) {
+ if ( open( SYMBIAN_PORT_H, '>', 'symbian/symbian_port.h' ) ) {
my ($sdkmajor, $sdkminor);
if ($SDK_VARIANT eq 'S60') {
$S60SDK =~ /^(\d+)\.(\d+)$/;
sub create_PerlApp_pkg {
print "\tsymbian\\PerlApp.pkg\n";
- if ( open( PERLAPP_PKG, ">symbian\\PerlApp.pkg" ) ) {
+ if ( open( PERLAPP_PKG, '>', 'symbian\\PerlApp.pkg' ) ) {
my $ProductId =
defined $S60SDK ?
qq[;Supports Series 60 v0.9\n(0x101F6F88), 0, 0, 0, {"Series60ProductID"}\n] :
"$APPS\\PerlApp.rsc"-"!:\\system\\apps\\PerlApp\\PerlApp.rsc"
$AIF
__EOF__
- if ( open( DEMOS, "perl symbian\\demo_pl list |" ) ) {
+ if ( open( DEMOS, '-|', "perl symbian\\demo_pl list" ) ) {
while (<DEMOS>) {
chomp;
if (defined $S90SDK) {
create_DynaLoader_cpp();
create_PerlApp_pkg();
-if ( open( PERLAPP_MMP, ">symbian/PerlApp.mmp" ) ) {
+if ( open( PERLAPP_MMP, '>', 'symbian/PerlApp.mmp' ) ) {
my @MACRO;
my @LIB;
push @MACRO, 'PERL_IMPLICIT_CONTEXT';
warn "$0: failed to create symbian\\PerlApp.mmp";
}
-if ( open( MAKEFILE, ">Makefile" ) ) {
+if ( open( MAKEFILE, '>', 'Makefile' ) ) {
my $perl = "perl$VERSION";
my $windef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$perl\\$WIN\\$perl.def";
my $windef2 = "..\\BWINS\\${perl}u.def";
warn "$0: failed to create Makefile: $!\n";
}
-if ( open( MAKEFILE, ">symbian/Makefile")) {
+if ( open( MAKEFILE, '>', 'symbian/Makefile')) {
my $wrap = defined $S60SDK && $S60SDK eq '1.2' && $WIN ne '${WIN}cw';
my $ABLD = $wrap ? 'perl b.pl': 'abld';
print "\tsymbian/Makefile\n";
__EOF__
close(MAKEFILE);
if ($wrap) {
- if ( open( B_PL, ">symbian/b.pl")) {
+ if ( open( B_PL, '>', 'symbian/b.pl')) {
print B_PL <<'__EOF__';
# abld.pl wrapper.
unlink $1 or warn "$0: $1: $!\n";
} elsif ($extract) {
defined $fh && close($fh);
- open($fh, ">$1") or die "$0: '$1': $!\n";
+ open($fh, ">", $1) or die "$0: '$1': $!\n";
print "Extracting $1\n";
} elsif ($list) {
print "$1\n";
my $newfn = $new{$fn};
unlink($newfn);
if (($read = sysread($fh, $buffer, $size)) == $size) {
- if (open(my $newfh, ">$newfn")) {
+ if (open(my $newfh, '>', $newfn)) {
binmode($newfh);
print $newfh unpack("H*", $buffer);
close($newfh);
print "\tErrno.pm\n";
$copy{"ext\\Errno\\Errno.pm"} = "$lib\\Perl\\$R_V_SV\\Errno.pm";
- open( my $cfg, "symbian/install.cfg" )
+ open( my $cfg, '<', "symbian/install.cfg" )
or die "$!: symbian/install.cfg: $!\n";
while (<$cfg>) {
next unless /^lib\s+(.+)/;
my $ext = $1;
$ext =~ s!-!::!g;
print "\t$ext\n";
- if ( open( my $pkg, $lst ) ) {
+ if ( open( my $pkg, '<', $lst ) ) {
while (<$pkg>) {
if (m!^"(.+)"-"(.+)"$!) {
my ( $src, $dst ) = ( $1, $2 );
qq[;Supports Series 90 v1.1\n(0x101FBE05), 0, 0, 0, {"Series90ProductID"}\n] :
";Supports Series NN";
- open PKG, ">$pkg" or die "$0: failed to create $pkg: $!\n";
+ open PKG, '>', $pkg or die "$0: failed to create $pkg: $!\n";
print PKG <<__EOF__;
; \u$target installation script
;
chdir($tempdir) or die "$0: chdir('$tempdir')\n";
if (@SisPl) {
- if (open(my $fi, "default.pl")) {
+ if (open(my $fi, "<", "default.pl")) {
my $fn = "default.pl.new";
- if (open(my $fo, ">$fn")) {
+ if (open(my $fo, ">", $fn)) {
while (<$fi>) {
last unless /^\#/;
print $fo $_;
my $cmd = "uidcrc $uids |";
- if (open(my $fh, $cmd)) {
+ if (open(my $fh, '<', $cmd)) {
my $line = <$fh>;
close($fh);
# 0x10000079 0x100039ce 0x0acebabe 0xc82b1900
my $UID_OFFSET = 0x0C7C; # This is where the uid is in the $app.
substr($app, $UID_OFFSET, 4) = substr($app, 8, 4); # Copy the uid also here.
- if (open(my $fh, ">$AppName.app")) {
+ if (open(my $fh, '>', "$AppName.app")) {
binmode($fh);
print $fh $app;
close($fh);
push @pkg, qq["$AppName.app"-"!:\\system\\apps\\$AppName\\$AppName.app"];
- if (open(my $fh, ">$AppName.rsc")) {
+ if (open(my $fh, '>', "$AppName.rsc")) {
binmode($fh);
print $fh hex2data($RSCHEX);
close($fh);
}
} else {
my $fn = "$AppName.pkg";
- if (open(my $fh, ">$fn")) {
+ if (open(my $fh, '>', $fn)) {
for my $l (@pkg) {
print $fh "$l\r\n"; # Note CRLF!
}
my %VERSION;
-if (open(PATCHLEVEL_H, "patchlevel.h")) {
+if (open(PATCHLEVEL_H, "<", "patchlevel.h")) {
while (<PATCHLEVEL_H>) {
if (/#define\s+PERL_(REVISION|VERSION|SUBVERSION)\s+(\d+)/) {
$VERSION{$1} = $2;
sub write_bld_inf {
my ($base) = @_;
print "\tbld.inf\n";
- open( BLD_INF, ">bld.inf" ) or die "$0: bld.inf: $!\n";
+ open( BLD_INF, '>', 'bld.inf' ) or die "$0: bld.inf: $!\n";
print BLD_INF <<__EOF__;
PRJ_MMPFILES
$base.mmp
sub read_mmp {
my ( $conf, $mmp ) = @_;
- if ( -r $mmp && open( MMP, "<$mmp" ) ) {
+ if ( -r $mmp && open( MMP, '<', $mmp ) ) {
print "\tReading $mmp...\n";
while (<MMP>) {
chomp;
for my $u (qw(SOURCE SOURCEPATH SYSTEMINCLUDE USERINCLUDE LIBRARY MACRO)) {
$CONF{$u} = uniquefy_filenames( $CONF{$u} );
}
- open( BASE_MMP, ">$base.mmp" ) or die "$0: $base.mmp: $!\n";
+ open( BASE_MMP, '>', "$base.mmp" ) or die "$0: $base.mmp: $!\n";
print BASE_MMP <<__EOF__;
TARGET $CONF{TARGET}
my $wrap = $SYMBIAN_ROOT && defined $SDK_VARIANT eq 'S60' && $SDK_VERSION eq '1.2' && $SYMBIAN_ROOT !~ /_CW$/;
my $ABLD = $wrap ? 'perl b.pl' : 'abld';
- open( MAKEFILE, ">Makefile" ) or die "$0: Makefile: $!\n";
+ open( MAKEFILE, '>', 'Makefile' ) or die "$0: Makefile: $!\n";
print MAKEFILE <<__EOF__;
WIN = $WIN
ARM = $ARM
__EOF__
close(MAKEFILE);
if ($wrap) {
- if(open(B,">b.pl")) {
+ if(open(B, '>', 'b.pl')) {
print B <<'__EOF__';
# abld.pl wrapper.
return unless $CoreBuild;
my $V = sprintf "%vd", $^V;
# create reverse patch script
- if (open(RSCRIPT, ">$config_restore_script")) {
+ if (open(RSCRIPT, '>', $config_restore_script)) {
print RSCRIPT <<__EOF__;
#!perl -pi.bak
s:\\Q$V:$R_V_SV:
my @MM = qw(VERSION XS_VERSION);
if ( -f "Makefile" ) {
print "\tReading MakeMaker Makefile...\n";
- if ( open( MAKEFILE, "Makefile" ) ) {
+ if ( open( MAKEFILE, '<', 'Makefile' ) ) {
while (<MAKEFILE>) {
for my $m (@MM) {
if (m!^$m = (.+)!) {
}
(&restore_config and die "$0: VERSION or XS_VERSION undefined\n")
unless defined $MM{VERSION} && defined $MM{XS_VERSION};
- if ( open( BASE_C, ">$basec" ) ) {
+ if ( open( BASE_C, '>', $basec ) ) {
print BASE_C <<__EOF__;
#ifndef VERSION
#define VERSION "$MM{VERSION}"
}
print "\t_init.c\n";
- open( _INIT_C, ">_init.c" )
+ open( _INIT_C, '>', '_init.c' )
or &restore_config and die "$!: _init.c: $!\n";
print _INIT_C <<__EOF__;
#include "EXTERN.h"
for my $submf ( glob("*/Makefile") ) {
my $d = dirname($submf);
print "Configuring Encode::$d...\n";
- if ( open( SUBMF, $submf ) ) {
+ if ( open( SUBMF, '<', $submf ) ) {
if ( update_dir($d) ) {
my @subsrc;
while (<SUBMF>) {
print "\t$lstname.lst\n";
my $lstout =
$CoreBuild ? "$BUILDROOT/symbian/$lstname.lst" : "$BUILDROOT/$lstname.lst";
- if ( open( my $lst, ">$lstout" ) ) {
+ if ( open( my $lst, '>', $lstout ) ) {
for my $f (@lst) { print $lst qq["$f"-"!:$lst{$f}"\n] }
close($lst);
}
if $CoreBuild && $Build && !-f "lib\\Config.pm";
if ($CoreBuild) {
- open( my $cfg, "symbian/install.cfg" )
+ open( my $cfg, '<', 'symbian/install.cfg' )
or die "$0: symbian/install.cfg: $!\n";
my $extdir = $dir;
$extdir =~ s:^ext\\::;
system_echo("make @TARGET") == 0 or die "$0: make #2 failed\n";
unlink("$base.mmp.bak");
- open( _INIT_C, ">_init.c" ) or die "$0: _init.c: $!\n";
+ open( _INIT_C, '>', '_init.c' ) or die "$0: _init.c: $!\n";
print _INIT_C <<'__EOF__';
#include "EXTERN.h"
#include "perl.h"
for my $f ("$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$base\\WINS\\perl$VERSION-$extdash.def",
"..\\BMARM\\perl$VERSION-${extdash}u.def") {
print "\t($f - ";
- if ( open( $def, $f ) ) {
+ if ( open( $def, '<', $f ) ) {
print "OK)\n";
$basef = $f;
last;
delete local @ENV{qw(IFS CDPATH ENV BASH_ENV)};
if (-x "/usr/bin/locale"
- && open(LOCALES, "/usr/bin/locale -a 2>/dev/null|"))
+ && open(LOCALES, '-|', "/usr/bin/locale -a 2>/dev/null"))
{
while (<LOCALES>) {
# It seems that /usr/bin/locale steadfastly outputs 8 bit data, which
$runperl_args->{progfile} ||= $tmpfile;
$runperl_args->{stderr} = 1 unless exists $runperl_args->{stderr};
- open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!";
+ open TEST, '>', $tmpfile or die "Cannot open $tmpfile: $!";
print TEST $prog;
close TEST or die "Cannot close $tmpfile: $!";
$file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
sub compute_intrinsics {
&safedir;
local($TMP) = "$SAFEDIR/c2ph-i.$$.c";
- open (TMP, ">$TMP") || die "can't open $TMP: $!";
+ open (TMP, ">", $TMP) || die "can't open $TMP: $!";
select(TMP);
print STDERR "computing intrinsic sizes: " if $trace;
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
File::Spec->updir, qw[dist Module-CoreList]
), "corelist");
-if (open(IN, $script)) {
+if (open(IN, '<', $script)) {
print OUT <IN>;
close IN;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $cpan = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, qw(cpan CPAN scripts)), "cpan");
-if (open(CPAN, $cpan)) {
+if (open(CPAN, '<', $cpan)) {
print OUT <CPAN>;
close CPAN;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $enc2xs = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "cpan", "Encode", "bin"), "enc2xs");
-if (open(ENC2XS, $enc2xs)) {
+if (open(ENC2XS, '<', $enc2xs)) {
print OUT <ENC2XS>;
close ENC2XS;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $enc2xs = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "cpan", "Encode", "bin"), "encguess");
-if (open(ENC2XS, $enc2xs)) {
+if (open(ENC2XS, '<', $enc2xs)) {
print OUT <ENC2XS>;
close ENC2XS;
} else {
$file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
}
}
- open(IN,"$file") || (($Exit = 1),(warn "Can't open $file: $!\n"),next);
- open(OUT,">$Dest_dir/$outfile") || die "Can't create $outfile: $!\n";
+ open(IN, "<", "$file") || (($Exit = 1),(warn "Can't open $file: $!\n"),next);
+ open(OUT, ">", "$Dest_dir/$outfile") || die "Can't create $outfile: $!\n";
}
print OUT
return if ($file eq "-");
- open HEADER, $file or return;
+ open HEADER, "<", $file or return;
while (defined($line = <HEADER>)) {
while (/\\$/) { # Handle continuation lines
chop $line;
# Can we skip building the preamble file?
if (-r $preamble) {
# Extract version number from first line of preamble:
- open PREAMBLE, $preamble or die "Cannot open $preamble: $!";
+ open PREAMBLE, "<", $preamble or die "Cannot open $preamble: $!";
my $line = <PREAMBLE>;
$line =~ /(\b\d+\b)/;
close PREAMBLE or die "Cannot close $preamble: $!";
my (%define) = _extract_cc_defines();
- open PREAMBLE, ">$preamble" or die "Cannot open $preamble: $!";
+ open PREAMBLE, ">", $preamble or die "Cannot open $preamble: $!";
print PREAMBLE "# This file was created by h2ph version $VERSION\n";
# Prevent non-portable hex constants from warning.
#
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
# Scan the header file (we should deal with nested header files)
# Record the names of simple #define constants into const_names
# Function prototypes are processed below.
- open(CH, "<$rel_path_h") || die "Can't open $rel_path_h: $!\n";
+ open(CH, "<", "$rel_path_h") || die "Can't open $rel_path_h: $!\n";
defines:
while (<CH>) {
if ($pre_sub_tri_graphs) {
Devel::PPPort::WriteFile('ppport.h')
|| die "Can't create $ext$modpname/ppport.h: $!\n";
}
- open(XS, ">$modfname.xs") || die "Can't create $ext$modpname/$modfname.xs: $!\n";
+ open(XS, ">", "$modfname.xs") || die "Can't create $ext$modpname/$modfname.xs: $!\n";
if ($opt_x) {
warn "Scanning typemaps...\n";
get_typemap();
}
-d $modpmdir || mkpath([$modpmdir], 0, 0775);
-open(PM, ">$modpmname") || die "Can't create $ext$modpname/$modpmname: $!\n";
+open(PM, ">", "$modpmname") || die "Can't create $ext$modpname/$modpmname: $!\n";
$" = "\n\t";
warn "Writing $ext$modpname/$modpmname\n";
warn " Scanning $typemap\n";
warn("Warning: ignoring non-text typemap file '$typemap'\n"), next
unless -T $typemap ;
- open(TYPEMAP, $typemap)
+ open(TYPEMAP, "<", $typemap)
or warn ("Warning: could not open typemap file '$typemap': $!\n"), next;
my $mode = 'Typemap';
while (<TYPEMAP>) {
if (%types_seen) {
my $type;
warn "Writing $ext$modpname/typemap\n";
- open TM, ">typemap" or die "Cannot open typemap file for write: $!";
+ open TM, ">", "typemap" or die "Cannot open typemap file for write: $!";
for $type (sort keys %types_seen) {
my $entry = assign_typemap_entry $type;
} # if( ! $opt_X )
warn "Writing $ext$modpname/Makefile.PL\n";
-open(PL, ">Makefile.PL") || die "Can't create $ext$modpname/Makefile.PL: $!\n";
+open(PL, ">", "Makefile.PL") || die "Can't create $ext$modpname/Makefile.PL: $!\n";
my $prereq_pm = '';
# Create a simple README since this is a CPAN requirement
# and it doesn't hurt to have one
warn "Writing $ext$modpname/README\n";
-open(RM, ">README") || die "Can't create $ext$modpname/README:$!\n";
+open(RM, ">", "README") || die "Can't create $ext$modpname/README:$!\n";
my $thisyear = (gmtime)[5] + 1900;
my $rmhead = "$modpname version $TEMPLATE_VERSION";
my $rmheadeq = "=" x length($rmhead);
warn "Writing $ext$modpname/$testfile\n";
my $tests = @const_names ? 2 : 1;
-open EX, ">$testfile" or die "Can't create $ext$modpname/$testfile: $!\n";
+open EX, ">", "$testfile" or die "Can't create $ext$modpname/$testfile: $!\n";
print EX <<_END_;
# Before 'make install' is performed this script should be runnable with
unless ($opt_C) {
warn "Writing $ext$modpname/Changes\n";
$" = ' ';
- open(EX, ">Changes") || die "Can't create $ext$modpname/Changes: $!\n";
+ open(EX, ">", "Changes") || die "Can't create $ext$modpname/Changes: $!\n";
@ARGS = map {/[\s\"\'\`\$*?^|&<>\[\]\{\}\(\)]/ ? "'$_'" : $_} @ARGS;
print EX <<EOP;
Revision history for Perl extension $module.
}
warn "Writing $ext$modpname/MANIFEST\n";
-open(MANI,'>MANIFEST') or die "Can't create MANIFEST: $!";
+open(MANI, '>', 'MANIFEST') or die "Can't create MANIFEST: $!";
my @files = grep { -f } (<*>, <t/*>, <$fallbackdirname/*>, <$modpmdir/*>);
if (!@files) {
eval {opendir(D,'.');};
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
qw(cpan ExtUtils-MakeMaker bin)),
'instmodsh');
-if (open(INSTMODSH, $instmodsh)) {
+if (open(INSTMODSH, '<', $instmodsh)) {
print OUT <INSTMODSH>;
close INSTMODSH;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
File::Spec->updir, qw[cpan JSON-PP bin]
), "json_pp");
-if (open(IN, $script)) {
+if (open(IN, '<', $script)) {
print OUT <IN>;
close IN;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
$file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT, ">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
# get patchlevel.h timestamp
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting \"$file\" (with variable substitutions)\n";
$file .= '.com' if $^O eq 'VMS';
# Create output file.
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $piconv = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "cpan", "Encode", "bin"), "piconv");
-if (open(PICONV, $piconv)) {
+if (open(PICONV, '<', $piconv)) {
print OUT <PICONV>;
close PICONV;
} else {
$file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
$export_ok = "\@EXPORT_OK = qw(@export_ok);\n";
}
- if ( open(PM, ">$newname") ) {
+ if ( open(PM, ">", $newname) ) {
print PM <<"END";
package $newpack;
use 5.006;
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $prove = File::Spec->catfile(File::Spec->catdir(File::Spec->updir,
"cpan", "Test-Harness", "bin"), "prove");
-if (open(PROVE, $prove)) {
+if (open(PROVE, '<', $prove)) {
print OUT <PROVE>;
close PROVE;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
File::Spec->updir, qw[cpan Archive-Tar bin]
), "ptar");
-if (open(IN, $script)) {
+if (open(IN, '<', $script)) {
print OUT <IN>;
close IN;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
File::Spec->updir, qw[cpan Archive-Tar bin]
), "ptardiff");
-if (open(IN, $script)) {
+if (open(IN, '<', $script)) {
print OUT <IN>;
close IN;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
File::Spec->updir, qw[cpan Archive-Tar bin]
), "ptargrep");
-if (open(IN, $script)) {
+if (open(IN, '<', $script)) {
print OUT <IN>;
close IN;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
File::Spec->updir, qw[cpan Digest-SHA]
), "shasum");
-if (open(IN, $script)) {
+if (open(IN, '<', $script)) {
print OUT <IN>;
close IN;
} else {
$file .= '.com' if $^O eq 'VMS';
# Open input file before creating output file.
-$IN = File::Spec->catfile(File::Spec->updir, 'lib', 'diagnostics.pm');
-open IN or die "Can't open $IN: $!\n";
+$in = File::Spec->catfile(File::Spec->updir, 'lib', 'diagnostics.pm');
+open IN, '<', $in or die "Can't open $in: $!\n";
# Create output file.
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
lib ExtUtils)),
'xsubpp');
-if (open(XSUBPP, $xsubpp)) {
+if (open(XSUBPP, '<', $xsubpp)) {
print OUT <XSUBPP>;
close XSUBPP;
} else {
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open OUT, ">", $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
File::Spec->updir, qw[ cpan IO-Compress bin ]
), "zipdetails");
-if (open(IN, $script)) {
+if (open(IN, '<', $script)) {
print OUT <IN>;
close IN;
} else {
print "gen_shrfls.pl Rev. 8-Jul-2011\n" if $debug;
if ($ARGV[0] eq '-f') {
- open(INP,$ARGV[1]) or die "Can't read input file $ARGV[1]: $!\n";
+ open(INP,'<',$ARGV[1]) or die "Can't read input file $ARGV[1]: $!\n";
print "Input taken from file $ARGV[1]\n" if $debug;
@ARGV = ();
while (<INP>) {
# Linker wants /Include and /Library on different lines
print OPTBLD "$libperl/Include=($incstr)\n";
print OPTBLD "$libperl/Library\n";
-open(RTLOPT,$rtlopt) or die "$0: Can't read options file $rtlopt: $!\n";
+open(RTLOPT,'<',$rtlopt) or die "$0: Can't read options file $rtlopt: $!\n";
while (<RTLOPT>) { print OPTBLD; }
close RTLOPT;
close OPTBLD;
# [lazy - saves having to check for empty array - just test [0]==1]
@conditions = (1);
-open(INFIL,$infile) || die "Can't open $infile: $!\n";
-open(OUTFIL,">$outfile") || die "Can't open $outfile: $!\n";
+open(INFIL,'<',$infile) || die "Can't open $infile: $!\n";
+open(OUTFIL,'>',$outfile) || die "Can't open $outfile: $!\n";
print OUTFIL "#> This file produced from $infile by $0\n";
print OUTFIL "#> Lines beginning with \"#>\" were commented out during the\n";
}
my ($record,$magic,$signature,$offset,$size);
-open EXE, "+< $ARGV[0]" or die "Cannot open $ARGV[0]: $!\n";
+open EXE, '+<', $ARGV[0] or die "Cannot open $ARGV[0]: $!\n";
binmode EXE;
# read IMAGE_DOS_HEADER structure
my $line;
my $start= $Config{startperl};
$start= "#!perl" unless $start =~ /^#!.*perl/;
- open( FILE, $file ) or die "$0: Can't open $file: $!";
+ open( FILE, '<', $file ) or die "$0: Can't open $file: $!";
@file = <FILE>;
foreach $line ( @file ) {
$linenum++;
close( FILE );
$file =~ s/$OPT{'s'}$//oi;
$file .= '.bat' unless $file =~ /\.bat$/i or $file =~ /^-$/;
- open( FILE, ">$file" ) or die "Can't open $file: $!";
+ open( FILE, '>', $file ) or die "Can't open $file: $!";
print FILE $myhead;
print FILE $start, ( $OPT{'w'} ? " -w" : "" ),
"\n#line ", ($headlines+1), "\n" unless $linedone;
{ package magic; $^W= 0; } ## turn off warnings for when we run EXPR's
- unless (open(RC, "$file")) {
+ unless (open(RC, '<', $file)) {
$use_default=1;
$file = "<internal default startup file>";
## no RC file -- use this default.
}
if ($DO_MAGIC_TESTS) {
- if (!open(FILE_IN, $file)) {
+ if (!open(FILE_IN, '<', $file)) {
&clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT;
warn qq/$0: can't open: $file\n/;
next;
next;
} else {
## if we weren't doing magic tests, file won't be open yet...
- if (!$DO_MAGIC_TESTS && !open(FILE_IN, $file)) {
+ if (!$DO_MAGIC_TESTS && !open(FILE_IN, '<', $file)) {
&clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT;
warn qq/$0: can't open: $file\n/;
next;
my ($dynaloader_pm);
if ($opts{adaptation}) {
# let's copy our Dynaloader.pm (make this optional?)
- open my $fhdyna, ">$opts{distdir}/lib/Dynaloader.pm";
+ open my $fhdyna, '>', "$opts{distdir}/lib/Dynaloader.pm";
print $fhdyna $dynaloader_pm;
close $fhdyna;
}
sub copy($$) {
my ($fnfrom, $fnto) = @_;
- open my $fh, "<$fnfrom" or die "can not open $fnfrom: $!";
+ open my $fh, '<', $fnfrom or die "can not open $fnfrom: $!";
binmode $fh;
local $/;
my $ffrom = <$fh>;
}
}
mkpath $1 if $fnto=~/^(.*)\/([^\/]+)$/;
- open my $fhout, ">$fnto";
+ open my $fhout, '>', $fnto;
binmode $fhout;
print $fhout $ffrom;
if ($opts{'verbose'} >=2) {
warn "Writing $opt{CONFIG_H}\n";
-open(SH,"<$name") || die "Cannot open $name:$!";
+open(SH, "<", $name) || die "Cannot open $name:$!";
while (<SH>)
{
last if /^\s*sed/;
die "$str:$@" if $@;
-open(H,">$file.new") || die "Cannot open $file.new:$!";
+open(H, ">", "$file.new") || die "Cannot open $file.new:$!";
binmode(H);
while (<SH>)
{
shift @ARGV;
my $optfile = shift @ARGV;
local (*OPTF);
- open OPTF, $optfile or die "Can't open $optfile: $!\n";
+ open OPTF, '<', $optfile or die "Can't open $optfile: $!\n";
my @opts;
chomp(my $line = <OPTF>);
my @vars = split(/\t+~\t+/, $line);
my $pl_h = '../patchlevel.h';
if (-e $pl_h) {
- open PL, "<$pl_h" or die "Can't open $pl_h: $!";
+ open PL, "<", $pl_h or die "Can't open $pl_h: $!";
while (<PL>) {
if (/^#\s*define\s+(PERL_\w+)\s+([\d.]+)/) {
$opt{$1} = $2;