search.cpan.org is shutting down
Станислав Пусеп > Text-Roman-3.02 > Text::Roman
Module Version: 3.02   Source   Latest Release: Text-Roman-3.5

# NAME

Text::Roman - Converts Roman algorism to integer numbers and the contrary, recognize algorisms

version 3.02

# SYNOPSIS

    use Text::Roman;

my $roman = "XXXV"; my$mroman = 'L_X_XXIII';
print roman(123), "\n";
print roman2int($roman), "\n" if isroman($roman);
print mroman2int($mroman), "\n" if ismroman($mroman);

# DESCRIPTION

Text::Roman::roman() is a very simple algorism converter. It converts a single integer (in Arabic algorisms) at a time to its Roman correspondent. The conventional Roman numbers goes from 1 up to 3999. MROMANS (milhar romans) range is 1 up to 3999 * 1000 + 3999 = 4002999.

There is no concern for mix cases, like 'Xv', 'XiiI', as legal Roman algorism numbers.

# FUNCTIONS

## ismroman($str) Verify whether the given string is a milhar Roman number, if it is return 1; if it is not return 0. ## isroman($str)

Verify whether the given string is a conventional Roman number, if it is return 1; if it is not return 0.

## roman(\$int)

Return string containing the Roman corresponding to the given integer, or '' if the integer is out of domain.

# SPECIFICATION

Roman number has origin in following BNF-like formula:

    a = I{1,3}
b = V\a?|IV|\a
e = X{1,3}\b?|X{0,3}IX|\b
ee = IX|\b
f = L\e?|XL\ee?|\e
g = C{1,3}\f?|C{0,3}XC\ee?|\f
gg = XC\ee?|\f
h = D\g?|CD\gg?|\g
j = M{1,3}\h?|M{0,3}CM\gg?|\h

# REFERENCES

Specification supplied by redactor's manual of newspaper "O Estado de São Paulo". URL: http://web.archive.org/web/20020819094718/http://www.estado.com.br/redac/norn-nro.html

# AUTHOR

Stanislaw Pusep <stas@sysd.org>