Acme::Numbers - a fluent numeric interface


Acme-Numbers documentation  | view source Contained in the Acme-Numbers distribution.

Index


NAME

Top

Acme::Numbers - a fluent numeric interface

SYNOPSIS

Top

    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

Top

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

Top

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

Top

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.


Acme-Numbers documentation  | view source Contained in the Acme-Numbers distribution.