Locale::Utils::PlaceholderNamed - Utils to expand named placeholders
$Id: PlaceholderNamed.pm 587 2015-04-16 05:58:10Z steffenw $
$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/Locale-Utils-PlaceholderNamed/trunk/lib/Locale/Utils/PlaceholderNamed.pm $
1.002
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);
Utils to expand named placeholders.
see SYNOPSIS
If is_strict is false: undef will be converted to q{}. If is_strict is true: no replacement.
$obj->is_strict(1); # boolean true or false;
The modifier code handles named attributes to modify the given placeholder value.
If the placeholder name is {foo:bar} then foo is the placeholder name and bar the attribute name. Space in front of the attribute name is allowed, e.g. {foo :bar}.
{foo:bar}
{foo :bar}
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);
To switch off this code - clear them.
$obj->clear_modifier_code;
Expands strings containing named placeholders like {name}.
{name}
$text = 'foo {name} baz'; %args = ( name => 'bar', ); $expanded = $obj->expand_named($text, %args);
or
$expanded = $obj->expand_text($text, \%args);
Inside of this distribution is a directory named javascript. For more information see: Locale::TextDomain::OO::JavaScript
This script depends on http://jquery.com/.
Inside of this distribution is a directory named example. Run the *.pl files.
none
Carp
Moo
MooX::StrictConstructor
MooX::Types::MooseLike
namespace::autoclean
not known
http://en.wikipedia.org/wiki/Gettext
Locale::TextDomain
Steffen Winkler
Copyright (c) 2011 - 2017, Steffen Winkler <steffenw at cpan.org>. All rights reserved.
<steffenw at cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Locale::Utils::PlaceholderNamed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Locale::Utils::PlaceholderNamed
CPAN shell
perl -MCPAN -e shell install Locale::Utils::PlaceholderNamed
For more information on module installation, please visit the detailed CPAN module installation guide.