Lingua::Num2Word
version 0.0682
wrapper for number to text conversion modules of various languages in the Lingua:: hierarchy.
A wrapper for mosules in the Lingua::XXX hierarchy. XXX is a code from the ISO 639-3 namespace.
use Lingua::Num2Word; my $numbers = Lingua::Num2Word->new; # try to use czech module (Lingua::CES::Num2Word) for conversion to text my $text = $numbers->cardinal( 'ces', 123 ); # or procedural usage if you dislike OO my $text = Lingua::Num2Word::cardinal( 'ces', 123 ); print $text || "sorry, can't convert this number into czech language."; # check if number is in supported interval before conversion my $number = 999_999_999_999; my $limit = $numbers->get_interval('ces'); if ($limit) { if ($number > $$limit[1] || $number < $$limit[0]) { print "Number is outside of supported range - <$$limit[0], $$limit[1]>."; } else { print Lingua::Num2Word::cardinal( 'ces', $number ); } } else { print "Unsupported language."; }
A wrapper for Lingua::XXX::num2word modules.
Lingua::Num2Word is a wrapper for modules for converting numbers into their equivalent in written representation.
This is a wrapper for various Lingua::XXX::Num2Word modules that do the conversions for specific languages. Output encoding is utf-8.
For further information about various limitations of the specific modules see their documentation.
# }}} # {{{ Functions reference
1 string target language 2 number number to convert => string converted string undef if input number is not supported
Conversion from number to text representation in specified language.
1 string language specification => array|arref list with min max values undef if specified language is not known
Returns the minimal and maximal number (inclusive) supported by the conversion in a specified language. The returned value is a list of two elements (low,high) or reference to this list depending on calling context. In case a unsupported language is passed undef is returned.
=> array|arref list of supproted languages
List of all currently supported languages. Return value is a list or a reference to a list depending on calling context.
=> array|arref list of languages known by ISO 639-3 list
List of all known language codes from iso639. Return value is list or reference to list depending on calling context.
Constructor.
Private.
Language codes and names from iso639 can be found at http://www.triacom.com/archive/iso639.en.html
This module is only wrapper and requires other CPAN modules for requested conversions eg. Lingua::AFR::Numbers for Afrikaans.
Currently supported languages/modules are:
coding, maintenance, refactoring, extensions, specifications: Richard C. Jelinek <info@petamem.com> initial coding after specifications by R. Jelinek: Roman Vasicek <info@petamem.com>
Copyright (C) PetaMem, s.r.o. 2002-present
Artistic license or BSD license.
To install Lingua::Num2Word, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::Num2Word
CPAN shell
perl -MCPAN -e shell install Lingua::Num2Word
For more information on module installation, please visit the detailed CPAN module installation guide.