The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Locale::Utils::PlaceholderNamed - Utils to expand named placeholders

$Id: PlaceholderNamed.pm 392 2011-12-06 11:56:46Z steffenw $

$HeadURL: https://perl-gettext-oo.svn.sourceforge.net/svnroot/perl-gettext-oo/Locale-Utils-PlaceholderNamed/trunk/lib/Locale/Utils/PlaceholderNamed.pm $

VERSION

0.003

SYNOPSIS

    use Locale::Utils::PlaceholderNamed;

    my $obj = Locale::Utils::PlaceholderNamed->new(
        # optional strict switch
        strict => 1,
    );

    $expanded = $obj->expand_named($text, %args);

DESCRIPTION

Utils to expand named placeholders.

SUBROUTINES/METHODS

method strict

If strict is true: undef will be converted to q{}. If strict is false: no replacement.

    $obj->strict(1); # boolean true or false;

method expand_text

Expands strings containing named placeholders like {name}.

    $text = 'foo {name} baz';
    %args = (
        name => 'bar',
    );

    $expanded = $obj->expand_text($text, %args);

EXAMPLE

Inside of this distribution is a directory named example. Run the *.pl files.

DIAGNOSTICS

none

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Moose

MooseX::StrictConstructor

MooseX::Types::Moose

namespace::autoclean

syntax

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

not known

SEE ALSO

http://en.wikipedia.org/wiki/Gettext

http://translate.sourceforge.net/wiki/l10n/pluralforms

Locele::TextDomain

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2011 - 2012, 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.