commit:     265d1c4d0aff8e5bf4569488924b0372e68439fa
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Nov 17 19:52:52 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Nov 17 19:52:52 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=265d1c4d

mkconfig: use read_dir() from File::Slurper

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 mkconfig | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mkconfig b/mkconfig
index aba7ec5..17c72ac 100755
--- a/mkconfig
+++ b/mkconfig
@@ -13,7 +13,7 @@ use v5.36;
 use File::Spec::Functions qw(catdir catfile);
 use Unicode::Normalize qw(NFKD);
 
-use File::Slurper qw(read_lines read_text);
+use File::Slurper qw(read_dir read_lines read_text);
 
 {
        # The first argument shall be treated as a prefix, if any.
@@ -62,7 +62,7 @@ use File::Slurper qw(read_lines read_text);
 
 sub map_locale_attributes ($prefix) {
        my $top = catdir($prefix, '/usr/share/i18n/locales');
-       opendir(my $dh, $top) or die "Can't open '$top' as a directory: $!";
+       my @entries = read_dir($top);
        my $regex = qr/
                ^
                language  # attribute key
@@ -75,8 +75,7 @@ sub map_locale_attributes ($prefix) {
                $
        /mx;
        my %attr_by;
-       while (my $locale = readdir $dh) {
-               next if $locale =~ m/^\./;
+       for my $locale (@entries) {
                my $data = read_text("$top/$locale");
                my %attr;
                if ($data =~ $regex) {

Reply via email to