commit: 315fe56307f69ccebb732f20a0470ab67683d2f1 Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Fri Aug 15 05:34:25 2025 +0000 Commit: Kerin Millar <kfm <AT> plushkava <DOT> net> CommitDate: Fri Aug 15 05:34:25 2025 +0000 URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=315fe563
mkconfig: capture basename directly in map_locale_attributes() Signed-off-by: Kerin Millar <kfm <AT> plushkava.net> mkconfig | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mkconfig b/mkconfig index c67c630..5a7251f 100755 --- a/mkconfig +++ b/mkconfig @@ -10,7 +10,7 @@ # License GPL-2.0-only <https://spdx.org/licenses/GPL-2.0-only.html> use v5.36; -use File::Spec::Functions qw(catfile splitpath); +use File::Spec::Functions qw(catfile); # Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it. delete $ENV{'BASH_ENV'}; @@ -62,7 +62,7 @@ sub map_locale_attributes ($prefix) { iconv -f UTF-8 -t US-ASCII//TRANSLIT }; my $regex = qr/ - (\Q$top\E\/[^\/:]+) # pathname + \Q$top\E\/([^\/:]+) # basename : # separates pathname from matching line (language|territory) # attribute key \h+ # one or more <blank> characters @@ -71,7 +71,7 @@ sub map_locale_attributes ($prefix) { my %attr_by; for my $line (@lines) { if ($line =~ m/^${regex}$/) { - my ($locale, $key, $val) = (basename($1), $2, ucfirst $3); + my ($locale, $key, $val) = ($1, $2, ucfirst $3); if ($key eq 'territory') { if ($val =~ m/^Myanmar/) { $val = 'Myanmar/Burma'; @@ -84,7 +84,3 @@ sub map_locale_attributes ($prefix) { } return \%attr_by; } - -sub basename ($path) { - return (splitpath($path))[-1]; -}
