Skip to content

Latest commit

 

History

History
146 lines (82 loc) · 4.08 KB

Time.pod

File metadata and controls

146 lines (82 loc) · 4.08 KB

NAME

Random::Time returns a random time unit, random day part, random time, or random frequency.

VERSION

This document describes Random::Time version 1.000.

SYNOPSIS

use Random::Time qw(random_time_unit random_day_part random_time random_frequency);

my $time_unit          = random_time_unit;
my $standard_time_unit = random_time_unit('general');
my $game_time_unit     = random_time_init('game');

print random_time_unit('help')

my $day_part = random_day_part;

my $time          = random_time;
my $standard_time = random_time('general');
my $game_time     = random_time('game');

my $frequency = random_frequency;

DESCRIPTION

Random::Time returns a random time unit, random day part, random time, or random frequency. You need to import the functions into your script.

random_time_unit

random_time_unit returns a random unit of time from a second to a millennium. It has two optional parameters: the list option and any units of time you want to add to the list.

Options

nothing, all, or undef

random_time_unit;
random_time_unit();
random_time_unit('all');
random_time_unit(undef);

These options return any value in any list. You can read the options below to see all of the potential values.

general

random_time_unit('general');

The general option returns second, minute, hour, day, week, month, year, decade, century, or millennium.

game

random_time_unit('game');

The game option returns segment, round, or turn.

by keys

random_time_unit('by keys');

The by keys option will select a random key listed above.

keys

random_time_unit('keys');

The keys option will list all of the available keys in an array reference.

data

random_time_unit('data');

The data option will return the data used in a hash reference.

help or options

random_time_unit('help');
random_time_unit('options');

The help or options options will return a list of all of your options.

Adding items to a list

my @additions = ('time unit 1', 'time unit 2');
random_time_unit('<your option>', \@additions);

You can add items to the list by adding an array reference with the additional items as the second parameter.

random_day_part

random_day_part returns a random part of the day and has no parameters. If the part of the day is morning, afternoon, or evening; the returned string will read "in the morning", "in the afternoon", or "in the evening". The the part of the day is dawn, midmorning, noon, midday, dusk, night, or midnight; the returned string will read "at dawn", "at midmorning", "at noon", "at midday", "at dusk", "at night", or "at midnight".

random_time

random_time returns a random time and has one parameter. It combines random_time_unit with random_day_part. Time units that are a day or shorter will return just the time unit, every other time unit will be suffixed with a day part phrase. There are sixty-eight possible combinations, so I will not list them all here, but I will give a few examples of the output.

hour
century in the afternoon
decade at night
week in the morning
segment

Options

nothing, all, or undef

See the description for nothing, all, or undef in random_time_unit.

general

See the description for general in random_time_unit.

game

See the description for game in random_time_unit.

random_frequency

random_frequency returns a random frequency for when something could happen from one time to twenty times a time unit. It has no parameters.

5 times a year
3 times a month
7 times an hour
2 times a century
13 times a round

DEPENDENCIES

Random::Time depends on Fancy::Rand, Random::SpecialDice, Lingua::EN::Inflect, and Exporter.

AUTHOR

Lady Aleena

LICENSE AND COPYRIGHT

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

Copyright © 2020, Lady Aleena (aleena@cpan.org). All rights reserved.