use modern file open instead of GLOBS
authorespie <espie@openbsd.org>
Mon, 6 Nov 2023 08:05:45 +0000 (08:05 +0000)
committerespie <espie@openbsd.org>
Mon, 6 Nov 2023 08:05:45 +0000 (08:05 +0000)
gnu/usr.bin/perl/cpan/Term-Cap/Cap.pm

index 3f2e7ea..7095c64 100644 (file)
@@ -312,15 +312,15 @@ sub Tgetent
             $state = 1;    # ok, maybe do a new file next time
         }
 
-        open( TERMCAP, "< $TERMCAP\0" ) || croak "open $TERMCAP: $!";
-       while (<TERMCAP>) {
+        open(my $fh, '<', $TERMCAP) || croak "open $TERMCAP: $!";
+       while (<$fh>) {
            next if /^\t/ || /^#/;
            if (m/(^|\|)\Q$tmp_term\E[:|]/) {
                chomp;
                s/^[^:]*:// if $first++;
                $state = 0;
                while (s/\\$//) {
-                   defined(my $x = <TERMCAP>) or last;
+                   defined(my $x = <$fh>) or last;
                    $_ .= $x; chomp;
                }
                last;
@@ -328,7 +328,7 @@ sub Tgetent
        }
        defined $entry or $entry = '';
        $entry .= $_ if $_;
-        close TERMCAP;
+        close $fh;
 
         # If :tc=...: found then search this file again
         $entry =~ s/:tc=([^:]+):/:/ && ( $tmp_term = $1, $state = 2 );