Data::Maker::Field::Currency - A Data::Maker field class used for generating random currency values.
use Data::Maker; use Data::Maker::Field::Currency; my $maker = Data::Maker->new( record_count => 10, fields => [ { name => 'price', class => 'Data::Maker::Field::Currency', args => { min => 200, max => 3000, iso_code => 'USD' } } ] );
Data::Maker::Field::Currency is a subclass of Data::Maker::Field::Number, with the precision attribute set to 2 and the separate_thousands attribute defined as true.
precision
separate_thousands
This class also supports the following Moose attributes:
iso_code
A valid currency code, as defined by ISO 4217. Defaults to USD.
code
An alias for iso_code
as_float (Bool)
If set to a true value, the generated value will be returned as a float, without any currency formatting.
with_code (Bool)
If set to a true value, the generated value will be returned, prefixed by the country code
John Ingram (john@funnycow.com)
Copyright 2010 by John Ingram. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Data::Maker::Field::Currency, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Maker::Field::Currency
CPAN shell
perl -MCPAN -e shell install Data::Maker::Field::Currency
For more information on module installation, please visit the detailed CPAN module installation guide.