Interchange6::Currency - Currency objects for Interchange 6
0.101
Currency objects for Interchange6 Open Source eCommerce with Unicode CLDR localization and rate conversion.
Extends CLDR::Number::Format::Currency with accurate calculation functions using Math::BigFloat.
Many useful standard operators are overloaded and return currency objects if appropriate.
Although this class was written to satisfy the specific requirements of Interchange6 it is suitable for use as a standalone module. See "SEE ALSO" for other currency modules.
Value as simple decimal, e.g.: 3.45
All values are coerced into Math::BigFloat.
Defaults to Finance::Currency::Convert::WebserviceX.
The class name which handles conversion to a new currency_code.
currency_code
The converter class can be any class that supports the following method signature:
sub convert { my ($self, $price, $from, $to) = @_; return $converted_price; };
In addition this module supports the following converters:
Finance::Currency::Convert::WebserviceX
Vivified "converter_class".
Sets precision for automatic rounding of "value" to "maximum_fraction_digits" in CLDR::Number::Format::Currency.
Returns clone of the currency object possibly with new attribute values (if any are supplied).
Convert to new currency using "converter".
NOTE: If /convert is called in void context then the currency object is mutated in place. If called in list or scalar context then the original object is not modified and a new Interchange6::Currency object is returned instead.
/convert
Stringified formatted currency, e.g.: $3.45
Alias for "as_string".
Add $arg to "value" in place.
$arg
Subtract $arg from "value" in place.
Multiply "value" by $arg in place.
Divide "value" by $arg in place.
Return "value" % $arg as currency object.
%
Equivalent to "value" <=> $arg.
<=>
String comparison.
Not always useful in itself since string comparison of stringified currency objects might not produce what you expect depending on locale and currency code.
Other modules which perform currency maths:
Math::Currency
Data::Currency
Other Interchange6 eCommerce modules:
Interchange6
Interchange6::Schema
Dancer::Plugin::Interchange6
Peter Mottram (SysPete), peter@sysnix.com
peter@sysnix.com
Shutterstock, Inc for the excellent CLDR::Number and all of the authors of Math::BigFLoat and Moo.
Copyright 2015-2016 Peter Mottram (SysPete).
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
Unicode is a registered trademark of Unicode, Inc., in the United States and other countries.
To install Interchange6::Currency, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Interchange6::Currency
CPAN shell
perl -MCPAN -e shell install Interchange6::Currency
For more information on module installation, please visit the detailed CPAN module installation guide.