The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lingua::Slavic::Numbers - Converts numeric values into their Slavic string equivalents. Bulgarian is supported so far.

SYNOPSIS

 # Procedural Style
 use Lingua::Slavic::Numbers qw(number_to_slavic ordinate_to_slavic);
 print number_to_slavic('bg', 345 );

 my $twenty  = ordinate_to_slavic('bg', 20 );
 print "Ordinate of 20 is $twenty";

 # OO Style
 use Lingua::Slavic::Numbers;
 # specifies default language
 my $number = Lingua::Slavic::Numbers->new( 123, Lingua:Slavic::Numbers::LANG_BG );
 print $number->get_string;
 print $number->get_ordinate;
 # override language
 print $number->get_string(Lingua:Slavic::Numbers::LANG_BG);
 print $number->get_ordinate(Lingua:Slavic::Numbers::LANG_BG);

 # default language, no number
 my $other_number = Lingua::Slavic::Numbers->new(Lingua:Slavic::Numbers::LANG_BG);
 $other_number->parse( 7340 );
 $bg_string = $other_number->get_string;

DESCRIPTION

This module converts a number into a Slavic-language cardinal or ordinal. Bulgarian is supported so far.

The interface tries to conform to the one defined in Lingua::EN::Number, though this module does not provide any parse() method. Also, unlike Lingua::En::Numbers, you can use this module in a procedural manner by importing the number_to_LL() function (LL=bg so far).

If you plan to use this module with greater numbers (>10e20), you can use the Math::BigInt module:

 use Math::BigInt;
 use Lingua::Slavic::Numbers qw( number_to_slavic );

 my $big_num = new Math::BigInt '1.23e68';
 print number_to_slavic('bg', $big_num);

FUNCTION-ORIENTED INTERFACE

number_to_slavic( $lang, $number )

 use Lingua::Slavic::Numbers qw(number_to_slavic);
 my $depth = number_to_slavic('bg', 20_000 );
 my $year  = number_to_slavic('bg', 1870 );

 # in honor of Lingua::FR::Numbers, which I copied to start this
 # module, I'm using a French example
 print "Жул Верн написа ,,$depth левги под морето'' в $year.";

This function can be exported by the module.

ordinate_to_slavic( $lang, $number )

 use Lingua::Slavic::Numbers qw(ordinate_to_slavic);
 my $twenty  = ordinate_to_slavic('bg', 20 );
 print "Номер $twenty";

This function can be exported by the module.

CONSTANTS

Bulgarian: Lingua:Slavic::Numbers::LANG_BG ('bg')

SOURCE

Lingua::FR::Numbers for the code

BUGS

Though the module should be able to convert big numbers (up to 10**36), I do not know how Perl handles them.

Please report any bugs or comments using the Request Tracker interface: https://rt.cpan.org/NoAuth/Bugs.html?Dist=Lingua-Slavic-Numbers

COPYRIGHT

Copyright 2008, Ted Zlatanov (Теодор Златанов). All Rights Reserved. This module can be redistributed under the same terms as Perl itself.

AUTHOR

Ted Zlatanov <tzz@lifelogs.com>

SEE ALSO

Lingua::EN::Numbers, Lingua::Word2Num

1 POD Error

The following errors were encountered while parsing the POD:

Around line 650:

Non-ASCII character seen before =encoding in '"Жул'. Assuming UTF-8