The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Maker::Field::Number - A Data::Maker field class used for generating numeric data.

SYNOPSIS

  use Data::Maker;
  use Data::Maker::Field::Number;

  my $maker = Data::Maker->new(
    record_count => 10,
    fields => [
      {
        name => 'population',
        class => 'Data::Maker::Field::Number',
        args => {
          min => 5000,
          max => 5000000
        }
      }
    ]
  );

DESCRIPTION

Data::Maker::Field::Number supports the following Moose attributes:

  • thousands_separator (Str)

    The string used to separate the thousands of the integer portion of the generated number. Defaults to ','

  • decimal_separator (Str)

    The string used to separate the integer portion from the decimal portion of the generated number. Defaults to '.'

  • separate_thousands (Bool)

    If set to a true value, the thousands of the integer portion of the generated number will be separated by the string defined by the thousands_separator attribute. Defaults to 0.

  • min (Num)

    The minimum number that is to be generated

  • max (Num)

    The maximum number that is to be generated

  • precision (Num)

    The maximum number of places to which the decimal portion of the number should be generated.

  • static_decimal (Num)

    If this attribute is defined, the decimal portion of the number is always given that value. For example, if you want random prices that all end with 99 cents, you could set this attribute to .99

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.