Locale:...derNamed(3)
π Locale::Utils::PlaceholderNamed π
okay bestie, so this page lives in the User Contributed Perl Documentation, manual section 3 (that's the library-functions section, iykyk), and the page title is Locale:...derNamed(3). Yes that's the truncated name, it's giving "the filesystem had a limit and we respect it". Let's go π«Ά
β¨ NAME β¨
Locale::Utils::PlaceholderNamed β Utils to expand named placeholders π
$Id: PlaceholderNamed.pm 667 2017-07-16 10:46:35Z steffenw $
$HeadURL:
svn:ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/Locale-Utils-PlaceholderNamed/trunk/lib/Locale/Utils/PlaceholderNamed.pm
$
wait, careful with that second one β it's exactlysvn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/Locale-Utils-PlaceholderNamed/trunk/lib/Locale/Utils/PlaceholderNamed.pmin the original, and the lines wrap weirdly around the$HeadURL:and the closing$. Copy it, don't retype it from memory π
πΈ VERSION πΈ
1.004 β that's the one, no cap β
π¦ SYNOPSIS π¦
use Locale::Utils::PlaceholderNamed;
my $obj = Locale::Utils::PlaceholderNamed->new(
# optional is_strict switch
is_strict => 1,
# optional modifier code
modifier_code => sub {
my ( $value, $attribute ) = @_;
return
$attribute eq '%.3f'
? sprintf($attribute, $value)
: $attribute eq 'accusative'
? accusative($value)
: $value;
},
);
$expanded = $obj->expand_named($text, %args);
$expanded = $obj->expand_named($text, \%args);
look at her, she's so tidy πβ¨
π DESCRIPTION π
Utils to expand named placeholders. That's the whole vibe, bestie. Named placeholders get expanded. π
π SUBROUTINES/METHODS π
method new
see SYNOPSIS β literally, go look up, it's right there π
method is_strict
Okay so this is the strictness switch and it matters:
- if
is_strictis false,undefgets converted toq{}(empty string, babes) - if
is_strictis true, there's no replacement at all
$obj->is_strict(1); # boolean true or false;
yes the comment in the original is just like that, and yes you pass it a boolean, true or false, iconic behavior π
method modifier_code, clear_modifier_code
The modifier code handles named attributes to modify the given placeholder value. It's the glow-up department for your placeholders β¨
So here's the tea: if the placeholder name is "{foo:bar}", then foo is the placeholder name and bar is the attribute name. And a space in front of the attribute name is allowed too, like "{foo :bar}". Look at her being flexible π
my $code_ref = sub {
my ( $value, $attribute ) = @_;
return
$attribute eq 'num.03'
? sprintf('%.03f, $value)
: $attribute eq 'accusative'
? accusative($value)
: $value;
};
$obj->modifier_code($code_ref);
(ngl that '%.03f up there is missing its closing quote β that's literally what the original page says, so I'm keeping it, don't @ me π)
Wanna switch off this code? Just clear it, bestie:
$obj->clear_modifier_code;
method expand_named
Expands strings containing named placeholders like "{name}". The moment we've all been waiting for π
$text = 'foo {name} baz';
%args = (
name => 'bar',
);
$expanded = $obj->expand_named($text, %args);
or
$expanded = $obj->expand_text($text, \%args);
yes, the "or" branch calls expand_text β that's what the page says, verbatim, character for character. Not a typo I introduced, I promise π«Ά
π§ JAVASCRIPT π§
Inside of this distribution is a directory named javascript. For more information see: Locale::TextDomain::OO::JavaScript π
This script depends on <http://jquery.com/>. (yes, jquery, she's vintage, she's a classic, she ate π₯)
π EXAMPLE π
Inside of this distribution is a directory named example. Run the *.pl files. Go on, run them, they don't bite π
π DIAGNOSTICS π
none
like, literally none. no drama. we love a low-maintenance module π
β CONFIGURATION AND ENVIRONMENT β
none
nothing to configure, nothing in your env, just vibes β¨
π DEPENDENCIES π
She does not stand alone, bestie, she has a whole friend group:
CarpMooMooX::StrictConstructorMooX::Types::MooseLikenamespace::autoclean
π INCOMPATIBILITIES π
not known
πΈ BUGS AND LIMITATIONS πΈ
not known
(no known bugs, main character energy fr fr π)
π₯ SEE ALSO π₯
- <http://en.wikipedia.org/wiki/Gettext>
Locale::TextDomain
π AUTHOR π
Steffen Winkler
π LICENSE AND COPYRIGHT π
Copyright (c) 2011 - 2017, Steffen Winkler "<steffenw at cpan.org>". All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π«Ά perl v5.42.0 blessed us with this one on 2025-07-25, and it's still serving Locale:...derNamed(3) in the User Contributed Perl Documentation like the absolute icon she is π
β¨ mwah, go expand some placeholders π
π¦ where this page comes from
- fedora 43: perl-Locale-Utils-PlaceholderNamed 1.004-24.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms