CLDR::Number::Format::Percent - Localized percent formatter using the Unicode CLDR
This document describes CLDR::Number::Format::Percent v0.05, built with Unicode CLDR v24.
# either use CLDR::Number::Format::Percent; my $perf = CLDR::Number::Format::Percent->new(locale => 'tr'); # or use CLDR::Number; my $cldr = CLDR::Number->new(locale => 'tr'); my $perf = $cldr->percent_formatter; say $perf->format(0.05); # '%5' (Turkish percent) $perf->locale('fr'); say $perf->format(0.05); # '5 %' (French percent) $perf->permil(1); say $perf->format(0.05); # '50 ‰' (French per mil)
Localized percent formatter using the Unicode Common Locale Data Repository (CLDR).
Accepts a number and returns a formatted percent as a character string, localized with the current locale. If the permil attribute is true, returns per mil instead of percent.
locale
permil
All string attributes are expected to be character strings. See also the common attributes in CLDR::Number.
Default: false (0)
0
Default: % when root locale
%
root
Default: ‰ when root locale
‰
Default: #,##0% when root locale
#,##0%
Default: 1 when root locale
1
Default: 0 when root locale
Default: 3 when root locale
3
Not used when value is 0.
0 and 1 are treated the same.
CLDR::Number
Nick Patch <patch@cpan.org>
This project is brought to you by Perl CLDR and Shutterstock. Additional open source projects from Shutterstock can be found at code.shutterstock.com.
© 2013–2014 Shutterstock, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CLDR::Number, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CLDR::Number
CPAN shell
perl -MCPAN -e shell install CLDR::Number
For more information on module installation, please visit the detailed CPAN module installation guide.