NAME

Data::Maker::Field::Currency - A Data::Maker field class used for generating random currency values.

SYNOPSIS

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'
      }
    }
  ]
);

DESCRIPTION

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.

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

AUTHOR

John Ingram (john@funnycow.com)

LICENSE

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.