Data::Maker::Field::Number - A Data::Maker field class used for generating numeric data.
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 } } ] );
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
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, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Maker
CPAN shell
perl -MCPAN -e shell install Data::Maker
For more information on module installation, please visit the detailed CPAN module installation guide.