Father Chrysostomos > Convert-Number-Greek > Convert::Number::Greek

Download:
Convert-Number-Greek-0.02a.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Convert::Number::Greek - Convert between Arabic and Greek numerals

VERSION ^

Version 0.02

SYNOPSIS ^

  use Convert::Number::Greek qw'num2greek greek2num';
  
  $greek_number = num2greek 1996;
  # $greek_number now contains
  # "\x{375}\x{3b1}\x{3e1}\x{3df}\x{3db}\x{374}"

  $number = greek2num "\x{3b5}\x{3c3}\x{3c4}\x{3b6}'";
  # $number now contains 567

DESCRIPTION ^

This module provides subroutines for converting between Arabic and Greek numbers.

FUNCTIONS ^

num2greek ( NUMBER, { OPTIONS } )

num2greek converts an Arabic numeral to a Greek numeral in the form of a Unicode string the syntax is as follows:

NUMBER is the number to convert. It should be a string of digits, nothing more (see BUGS, below). OPTIONS (optional) is a reference to a hash of boolean options. The options available are as follows:

 Option Name    Default Value   Description
 upper          0               Use uppercase Greek letters
 uc             0                "      "       "      "
 stigma         1               Use the stigma for 6 as opposed to
                                sigma followed by tau
 arch_koppa     0               Use the archaic koppa instead of
                                the modern one
 numbersign     1               Append a Greek number sign (U+0374)
                                to the resulting string

When you specify options, undef is treated as false, so

    num2greek $some_number, { uc => 1, stigma }

actually means

    num2greek $some_number, { uc => 1, stigma => 0 }
greek2num ( STRING )

The greek2num function parses a Greek numbers and returns the Arabic equivalent.

STRING is a string consisting of a Greek number. Anything following the number will be ignored, but will raise a warning if use warnings 'numeric' is on (unless it's just whitespace).

Currently no options are available.

EXPORTS ^

None by default, but you get num2greek and greek2num if you ask for them (politely).

DIAGNOSTICS ^

The greek2num function will trigger a "non-numeric" warning if you use warnings 'numeric'.

COMPATIBILITY ^

This module requires perl 5.8.0 or later, though the earliest version I have tested it with is 5.8.1.

BUGS ^

The num2greek function does not yet have any error-checking mechanism in place. The input should be a string of Arabic digits, or at least a value that stringifies to such. Using an argument that does not fit this description may produce nonsensical results.

AUTHOR ^

Father Chrysostomos <sprout @cpan.org>

syntax highlighting: