From 635cd2b4931a0cc3fb77729d5e93dce03b44be8d Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:26:06 +0800 Subject: [PATCH] file: 2-argument FileHandle->new --- bin/file | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/file b/bin/file index 418e3c9e..1541003c 100755 --- a/bin/file +++ b/bin/file @@ -120,7 +120,7 @@ GetOptions( # the names of the files are in $fileList. if ($fileList) { - my $fileListFH = FileHandle->new("< $fileList") or + my $fileListFH = FileHandle->new($fileList, 'r') or die "$F: $fileList: $!\n"; unshift(@ARGV,<$fileListFH>); $fileListFH->close(); @@ -148,7 +148,7 @@ print STDERR "Using magic file $magicFile\n" if $checkMagic; # $MF is the magic file state: [ filehandle, buffered last line, line num ] my $MF = []; -$$MF[0] = FileHandle->new("< $magicFile") or die "$magicFile: $!\n"; +$$MF[0] = FileHandle->new($magicFile, 'r') or die "$magicFile: $!\n"; $$MF[1] = undef; $$MF[2] = 0; readMagicEntry(\@magic,$MF); @@ -192,7 +192,7 @@ for my $file (@ARGV) { } # current file handle. or undef if checkMagic (-c option) is true. - my $fh = FileHandle->new("< $file") or die "$F: $file: $!\n" ; + my $fh = FileHandle->new($file, 'r') or die "$F: $file: $!\n" ; # 2) check for script if (-x $file && -T _) {