.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::Roman 3pm" .TH Text::Roman 3pm "2020-12-28" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Text::Roman \- Allows conversion between Roman and Arabic algarisms. .SH "VERSION" .IX Header "VERSION" version 3.5 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& #!/usr/bin/env perl \& use strict; \& use warnings; \& use Text::Roman qw(:all); \& \& print int2roman(123), "\en"; \& \& my $roman = "XXXV"; \& print roman2int($roman), "\en" if isroman($roman); \& \& my $milhar = \*(AqL_X_XXIII\*(Aq; # = 60,023 \& print milhar2int($milhar), "\en" if ismilhar($milhar); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This package supports both conventional Roman algarisms (which range from \fI1\fR to \fI3999\fR) and Milhar Romans, a variation which uses a bar across the algarism to indicate multiplication by \fI1_000\fR. For the purposes of this module, acceptable syntax consists of an underscore suffixed to the algarism e.g. \s-1IV_V\s0 = \fI4_005\fR. The term Milhar apparently derives from the Portuguese word for \*(L"thousands\*(R" and the range of this notation extends the range of Roman numbers to \fI3999 * 1000 + 3999 = 4_002_999\fR. .PP Note: the functions in this package treat Roman algarisms in a case-insensitive manner such that \*(L"\s-1VI\*(R"\s0 == \*(L"vI\*(R" == \*(L"Vi\*(R" == \*(L"vi\*(R". .PP The following functions may be imported into the caller package by name: .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "isroman" .IX Subsection "isroman" Tests a string to be a valid Roman algarism. Returns a boolean value. .SS "int2roman" .IX Subsection "int2roman" Converts an integer expressed in Arabic numerals, to its corresponding Roman algarism. If the integer provided is out of the range expressible in Roman notation, an \fIundef\fR is returned. .SS "roman2int" .IX Subsection "roman2int" Does the converse of \*(L"int2roman\*(R", converting a Roman algarism to its integer value. .SS "ismilhar" .IX Subsection "ismilhar" Determines whether a string qualifies as a Milhar Roman algarism. .SS "milhar2int" .IX Subsection "milhar2int" Converts a Milhar Roman algarism to an integer. .SS "ismroman/mroman2int/roman" .IX Subsection "ismroman/mroman2int/roman" These functions belong to the module's old interface and are considered deprecated. Do not use them in new code and they will eventually be discontinued; they map as follows: .IP "\(bu" 4 ismroman => \fBismilhar\fR .IP "\(bu" 4 mroman2int => \fBmilhar2int\fR .IP "\(bu" 4 roman => \fBint2roman\fR .SH "CHANGES" .IX Header "CHANGES" Some changes worth noting from this module's previous incarnation: .IP "\fInamespace imports\fR" 4 .IX Item "namespace imports" The call to \fBuse\fR must now explicitly request function names imported into it's namespace. .IP "\fIargument defaults/void context\fR" 4 .IX Item "argument defaults/void context" All functions now will operate on \fB\f(CB$_\fB\fR when no arguments are passed, and will set \fB\f(CB$_\fB\fR when called in a void context. This allows for writing code like: .Sp .Vb 3 \& @x = qw/V III XI IV/; \& roman2int() for @x; \& print join("\-", @x); .Ve .Sp instead of the uglier: .Sp .Vb 3 \& @x = qw/V III XI IV/; \& $_ = roman2int($_) for @x; \& print join("\-", @x); .Ve .SH "SPECIFICATION" .IX Header "SPECIFICATION" Roman algarisms may be described using the following BNF-like formula: .PP .Vb 9 \& a = I{1,3} \& b = V\ea?|IV|\ea \& e = X{1,3}\eb?|X{0,3}IX|\eb \& ee = IX|\eb \& f = L\ee?|XL\eee?|\ee \& g = C{1,3}\ef?|C{0,3}XC\eee?|\ef \& gg = XC\eee?|\ef \& h = D\eg?|CD\egg?|\eg \& j = M{1,3}\eh?|M{0,3}CM\egg?|\eh .Ve .SH "REFERENCES" .IX Header "REFERENCES" For a description of the Roman numeral system see: . A reference to Milhar Roman alagarisms (in Portuguese) may be found at: . .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" This module was originally written by Peter de Padua Krauss and submitted to \s-1CPAN\s0 by Stanislaw Pusep who has relinquished control to Erick Calder since the original author has never maintained it and can no longer be reached. .PP Erick have completely rewritten the module, implementing simpler algorithms to perform the same functionality, adding a test suite, a Changes file, etc. and providing more comprehensive documentation. .PP Ten years later, Stanislaw returned as a maintainer. .SH "AUTHOR" .IX Header "AUTHOR" Stanislaw Pusep .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2003 by Erick Calder . .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.