Template::Plugin::DataRandom - Plugin to access Data::Random method in Template Toolkit
[% USE r = DataRandom %] [% words = r.rndwrds(size => 10) %] [% chars = r.rndchrs(set => alpha, size => 5 %] [% set = r.rndset(set => ['string1', 'string2'], size => 5 %] [% enum = r.rndenum(set => ['string1', 'string2', .. ]) %] [% date = r.rnddate(min => '1998-12-31') %] [% time = r.rndtime(min => '12:00:00', max => 'now' ) %] [% dtime = r.rnddtime(min => '1978-9-21 4:0:0', max => 'now' ) %] [% img = r.rndimg(minwidth => '10', maxwidth => '80', bgcolor => [55,120,255]) %]
This plugin has been made to create random data on demand in your template. It is deeply inspired from Adekunle Olonoh Data::Random module.
This returns a list of random words given a wordlist. See below for possible parameters.
See "rand_words()" in Data::Random for more infos about available options.
This returns a list of random characters given a set of characters. See below for possible parameters.
See "rand_chars()" in Data::Random for more infos about available options.
This returns a random set of elements given an initial set. See below for possible parameters.
See "rand_set()" in Data::Random for more infos about available options.
This returns a random date in the form "YYYY-MM-DD". 2-digit years are not currently supported. Efforts are made to make sure you're returned a truly valid date--ie, you'll never be returned the date February 31st. See the options below to find out how to control the date range.
See "rand_date()" in Data::Random for more infos.
This returns a random time in the form "HH:MM:SS". 24 hour times are supported. See the options below to find out how to control the time range.
See "rand_datetime()" in Data::Random for more infos about available options.
This returns a random date and time in the form "YYYY-MM-DD HH:MM:SS". See the options below to find out how to control the date/time range.
This returns a random image. Currently only PNG images are supported. See below for possible parameters. See "rand_image()" in Data::Random for more infos about available options.
0.03
Emmanuel Quevillon, tuco@pasteur.fr
Copyright (c) 2010 Emmanuel Quevillon. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Template::Plugin, Data::Random
To install Template::Plugin::DataRandom, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::DataRandom
CPAN shell
perl -MCPAN -e shell install Template::Plugin::DataRandom
For more information on module installation, please visit the detailed CPAN module installation guide.