From 836f9a786391decc6fcc445f877438c688110d99 Mon Sep 17 00:00:00 2001 From: Dan Zeman Date: Tue, 12 Nov 2024 15:53:47 +0100 Subject: [PATCH] Perl critic: File handles should not be bare words. --- lib/Lingua/Interset.pm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/Lingua/Interset.pm b/lib/Lingua/Interset.pm index 31db8d4..fa90900 100644 --- a/lib/Lingua/Interset.pm +++ b/lib/Lingua/Interset.pm @@ -266,9 +266,9 @@ sub _find_drivers my $tpath = "$path/tagset"; if(-d $tpath) { - opendir(DIR, $tpath) or confess("Cannot read folder $tpath: $!\n"); - my @subdirs = readdir(DIR); - closedir(DIR); + opendir(my $dir, $tpath) or confess("Cannot read folder $tpath: $!\n"); + my @subdirs = readdir($dir); + closedir($dir); foreach my $sd (@subdirs) { my $sdpath = "$tpath/$sd"; @@ -276,9 +276,9 @@ sub _find_drivers { # It is possible that a subfolder of $PERLLIB is not readable. # We cannot complain about it. We will just silently proceed to the next available folder. - opendir(DIR, $sdpath) or next; - my @files = readdir(DIR); - closedir(DIR); + opendir(my $dir, $sdpath) or next; + my @files = readdir($dir); + closedir($dir); foreach my $file (@files) { my $fpath = "$sdpath/$file"; @@ -304,9 +304,9 @@ sub _find_drivers my $lipath = "$path/Lingua/Interset/Tagset"; if(-d $lipath) { - opendir(DIR, $lipath) or confess("Cannot read folder $lipath: $!\n"); - my @subdirs = readdir(DIR); - closedir(DIR); + opendir(my $dir, $lipath) or confess("Cannot read folder $lipath: $!\n"); + my @subdirs = readdir($dir); + closedir($dir); foreach my $sd (@subdirs) { my $sdpath = "$lipath/$sd"; @@ -314,9 +314,9 @@ sub _find_drivers { # It is possible that a subfolder of $PERLLIB is not readable. # We cannot complain about it. We will just silently proceed to the next available folder. - opendir(DIR, $sdpath) or next; - my @files = readdir(DIR); - closedir(DIR); + opendir(my $dir, $sdpath) or next; + my @files = readdir($dir); + closedir($dir); foreach my $file (@files) { my $fpath = "$sdpath/$file";