Simon Wistow > Acme-Numbers > Acme::Numbers

Download:
Acme-Numbers-1.2.tar.gz

Dependencies

Annotate this POD (1)

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.2   Source  

NAME ^

Acme::Numbers - a fluent numeric interface

SYNOPSIS ^

    use Acme::Numbers;

    print one."\n";                       # prints 1
    print two.hundred."\n";               # prints 200
    print forty.two."\n";                 # prints 42
    print six.hundred.and.sixty.six."\n"; # prints 666
    print one.million."\n";               # prints 1000000

    print three.point.one.four."\n";      # prints 3.14
    print one.point.zero.two."\n";        # prints 1.02
    print zero.point.zero.five."\n";      # prints 0.05

    print four.pounds."\n";               # prints "4.00"
    print four.pounds.five."\n";          # prints "4.05"
    print four.pounds.fifty."\n";         # prints "4.50"
    print four.pounds.fifty.five."\n";    # prints "4.55"

    print fifty.pence."\n";               # prints "0.50"
    print fifty.five.pence."\n";          # prints "0.55"
    print four.pounds.fifty.pence."\n";   # prints "4.50"
    print four.pounds.and.fifty.p."\n";   # prints "4.50"

    print fifty.cents."\n";               # prints "0.50"
    print fifty.five.cents."\n";          # prints "0.55"
    print four.dollars.fifty.cents."\n";  # prints "4.55"

DESCRIPTION ^

Inspired by this post

http://beautifulcode.oreillynet.com/2007/12/the_cardinality_of_a_fluent_in.php

and a burning curiosity. At leats, I hope the burning was curiosity.

ONE BIIIIIIIIIIIILLION ^

By default billion is 10**12 because, dammit, that's right.

If you want it to be an American billion then do

    use Acme::Numbers billion => 10**9;

Setting this automatically changes all the larger numbers (trillion, quadrillion, etc) to match.

METHODS ^

You should never really use these methods on the class directly.

All numbers handled by Lingua::EN::Words2Nums are handled by this module.

In addition ...

new <value> <operator>

operator can be 'num', 'and' or 'point'

name

The name of this object (i.e the method that was originally called).

value

The current numeric value

handle <Acme::Numbers>

Handle putting these two objects together

concat <value>

Concatenate two things.

syntax highlighting: