Podius::Property::Currency - component property representing currency (ISO 4217)
$property = new Podius::Property::Currency;
Supposed to be used in the Podius::Component manpage and the Podius::Property manpage module trees only.
This module implements component property allowing easy representation of currency as described in ISO 4217.
This property derives from Selection and has all its features. Additionally, there is an option to convert certain amount from/to the current currency to/from another one (if possible) and make other currency manipulations.
Note, that for get_conversion_rate, convert_amount_to_currency and convert_amount_from_currency methods to work, there is a need in CurrencyRates.pl that contains the hashref of conversion rates for the corresponding currency codes. You may use a cronjob to update this file using shipped generate-currency-rates or similar script.
The currency code (available by access or access_code methods) is a 3 english letter string, like ``USD'' or ``EUR''.
Only the methods different from the Podius::Property::Selecion manpage are described here.
the Podius::Property::Selection manpage, the Exception manpage.
Usually the semantics of the returned number is the units of the currency per one dollar, but the rate may be based on a different currency as well.
* optional other currency (property or code)
Returns the assigned currenct sign, like ``$'' or euro-sign. Usually this is one unicode chars or abbreviature.
Returns the assigned currenct label, like ``US Dollar'' or ``Euro''. This label may contain unicode chars for certain currencies.
It is possible to make adjustment to the base amount (relative or absolute, or even replace it) by passing the corresponding parameter. Pass any false value to disable adjustment. See examples.
* base amount * other currency (property or code) * adjustment (+X, -X, +X%, -X%, X, or undef/"" to disable) * precision (0..8 - force, 9 - as-is, undef/"" - use actual sub-units)
convert_amount_to_currency(amount, undef,
adjustment, precision), so no currency conversion is done.
* amount to format * adjustment (+X, -X, +X%, -X%, X, or undef/"" to disable) * precision (0..8 - force, 9 - as-is, undef/"" - use actual sub-units)
the Podius::Property::Selection manpage, the Podius::Property::CurrencyAmount manpage, the Podius::Property::Country manpage.