commit:     f3734dedc951341b45659b786e030ec77779759b
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Nov 17 20:21:48 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Nov 17 20:21:48 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f3734ded

mkconfig: refactor attribute processing in map_locale_attributes()

Have the map_locale_attributes() subroutine compose the 'attr' hash
before proceeding to operate on its values. Doing so renders the code
slightly more pleasant to read.

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 17c72ac..a57940c 100755
--- a/mkconfig
+++ b/mkconfig
@@ -79,13 +79,13 @@ sub map_locale_attributes ($prefix) {
                my $data = read_text("$top/$locale");
                my %attr;
                if ($data =~ $regex) {
-                       my ($language, $territory) = ($1, ucfirst $2);
-                       for ($language, $territory) {
+                       @attr{'language', 'territory'} = ($1, ucfirst $2);
+                       for (values %attr) {
                                if (m/[^\p{ASCII}]/) {
                                        $_ = to_ascii($_);
                                }
                        }
-                       for ($territory) {
+                       for ($attr{'territory'}) {
                                if (m/^Myanmar/) {
                                        $_ = 'Myanmar/Burma';
                                } elsif (m/^Russian Federation\z/) {
@@ -94,7 +94,6 @@ sub map_locale_attributes ($prefix) {
                                        $_ = 'Turkey';
                                }
                        }
-                       %attr = ('language' => $language, 'territory' => 
$territory);
                }
                $attr_by{$locale} = \%attr;
        }

Reply via email to