.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .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" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Roman 3pm" .TH Roman 3pm "2007-06-15" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Text::Roman \- Allows conversion between Roman and Arabic algarisms. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use Text::Roman qw/ \& isroman roman2int int2roman ismilhar milhar2int \& roman mroman2int ismroman \& /; .Ve .PP .Vb 1 \& print int2roman(123); .Ve .PP .Vb 2 \& $roman = "XXXV"; \& print roman2int($roman) if isroman($roman); .Ve .PP .Vb 2 \& $milhar = 'L_X_XXIII'; # = 60,023 \& print milhar2int($milhar) if ismilhar($milhar); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This package supports both conventional Roman algarisms (which range from 1 to 3999) and Milhar Romans, a variation which uses a bar across the algarism to indicate multiplication by 1,000. For the purposes of this module, acceptable syntax consists of an underscore suffixed to the algarism e.g. \s-1IV_V\s0 = 4,005. 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 3999 x 1000 + 3999 = 4,002,999. .PP Note: the functions in this package treat Roman algarisms in a case-insensitive manner such that \*(L"\s-1VI\s0\*(R" == \*(L"vI\*(R" == \*(L"Vi\*(R" == \*(L"vi\*(R". .PP The following functions may be imported into the caller package by name: .Sh "isroman" .IX Subsection "isroman" Tests a string to be a valid Roman algarism. Returns a boolean value. .Sh "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. .Sh "roman2int" .IX Subsection "roman2int" Does the converse of \fI\fIint2roman()\fI\fR, converting a Roman algarism to its integer value. .Sh "ismilhar" .IX Subsection "ismilhar" Determines whether a string qualifies as a Milhar Roman algarism. .Sh "milhar2int" .IX Subsection "milhar2int" Converts a Milhar Roman algarism to an integer. .Sh "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 "ismroman => \fBismilhar\fR" 4 .IX Item "ismroman => ismilhar" .PD 0 .IP "mroman2int => \fBmilhar2int\fR" 4 .IX Item "mroman2int => milhar2int" .IP "roman => \fBint2roman\fR" 4 .IX Item "roman => int2roman" .PD .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 its namespace. .IP "\fIargument defaults/void context\fR" 4 .IX Item "argument defaults/void context" All functions now will operate on \fB$_\fR when no arguments are passed, and will set \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: \fIhttp://www.novaroma.org/via_romana/numbers.html\fR. A reference to Milhar Roman alagarisms (in Portuguese) may be found at: \fIhttp://www.estado.estadao.com.br/redac/norn\-nro.html\fR. .SH "AUTHOR" .IX Header "AUTHOR" Erick Calder .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 me since the original author has never maintained it and can no longer be reached. .PP I 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. .SH "AVAILABILITY + SUPPORT" .IX Header "AVAILABILITY + SUPPORT" For questions, comments and support please feel free to e\-mail me. This module may be found on the \s-1CPAN\s0. Additionally, both the module and its \s-1RPM\s0 package are available from: .PP \&\fIhttp://perl.arix.com\fR .SH "DATE" .IX Header "DATE" $Date: 2003/01/16 01:56:34 $ .SH "VERSION" .IX Header "VERSION" $Revision: 3.3 $