Random::Day - Class for random day generation.
use Random::Day; my $obj = Random::Day->new(%params); my $dt = $obj->get; my $dt = $obj->random; my $dt = $obj->random_day($day); my $dt = $obj->random_day_month($day, $month); my $dt = $obj->random_day_month_year($day, $month, $year); my $dt = $obj->random_month($month); my $dt = $obj->random_month_year($month, $year); my $dt = $obj->random_year($year);
new(%params)
Constructor.
day
Day. Default value is undef.
dt_from
DateTime object from. Default value is DateTime object for 1900 year.
dt_to
DateTime object to. Default value is DateTime object for 2050 year.
month
Month. Default value is undef.
year
Year. Default value is undef.
get()
Get random date defined by constructor parameters. Returns DateTime object for date.
random()
Get random date. Returns DateTime object for date.
random_day($day)
Get random date defined by day. Returns DateTime object for date.
random_day_month($day, $month)
Get random date defined by day and month. Returns DateTime object for date.
random_day_month_year($day, $month, $year)
Get date defined by day, month and year Returns DateTime object for date.
random_month($month)
Get random date defined by month. Returns DateTime object for date.
random_month_year($month, $year)
Get random date defined by month and year. Returns DateTime object for date.
random_year($year)
Get random date defined by year. Returns DateTime object for date.
new(): From Class::Utils::set_params(): Unknown parameter '%s'. random_day(): Day cannot be a zero. Day isn't number. random_day_month(): Cannot create DateTime object. Day cannot be a zero. Day isn't number. random_day_month_year(): Cannot create DateTime object. Error: %s Day cannot be a zero. Day isn't number. random_month(): Cannot create DateTime object. Error: %s random_month_year(): Cannot create DateTime object. Error: %s
use strict; use warnings; use Random::Day; # Object. my $obj = Random::Day->new; # Get date. my $dt = $obj->get; # Print out. print $dt->ymd."\n"; # Output like: # \d\d\d\d-\d\d-\d\d
Class::Utils, DateTime, DateTime::Event::Random, DateTime::Event::Recurrence, English, Error::Pure.
Perl module to generate random data
https://github.com/tupinek/Random-Day
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© Michal Josef Špaček 2013-2017 BSD 2-Clause License
0.07
To install Random::Day, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Random::Day
CPAN shell
perl -MCPAN -e shell install Random::Day
For more information on module installation, please visit the detailed CPAN module installation guide.