line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#============================================================================ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Template::Plugin::DataRandom |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# DESCRIPTION |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# Plugin to use Data::Random in Template Toolkit |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# AUTHORS |
10
|
|
|
|
|
|
|
# Emmanuel Quevillon |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# COPYRIGHT |
13
|
|
|
|
|
|
|
# Copyright (C) 2010 Emmanuel Quevillon |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# This module is free software; you can redistribute it and/or |
16
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
#============================================================================ |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Template::Plugin::DataRandom; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
22458
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
23
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
7
|
use base 'Template::Plugin'; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1532
|
|
26
|
1
|
|
|
1
|
|
5544
|
use Template::Plugin; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
27
|
1
|
|
|
1
|
|
888
|
use Template::Exception; |
|
1
|
|
|
|
|
3631
|
|
|
1
|
|
|
|
|
33
|
|
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
938
|
use Data::Random qw(:all); |
|
1
|
|
|
|
|
19121
|
|
|
1
|
|
|
|
|
489
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$VERSION = '0.03'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
1
|
|
my($class, $context) = @_; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
bless { |
38
|
|
|
|
|
|
|
_CONTEXT => $context, |
39
|
|
|
|
|
|
|
},$class; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub rndwrds { |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
45
|
0
|
|
|
|
|
|
my $args = shift; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
return rand_words(%$args); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub rndchrs { |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
53
|
0
|
|
|
|
|
|
my $args = shift; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return rand_chars(%$args); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub rndset { |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
61
|
0
|
|
|
|
|
|
my $args = shift; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return rand_set(%$args); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub rndenum { |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
69
|
0
|
|
|
|
|
|
my $args = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return rand_enum(%$args); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub rnddate { |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
77
|
0
|
|
|
|
|
|
my $args = shift; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return rand_date(%$args); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub rndtime { |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
85
|
0
|
|
|
|
|
|
my $args = shift; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return rand_time(%$args); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub rnddtime { |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
93
|
0
|
|
|
|
|
|
my $args = shift; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
return rand_datetime(%$args); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub rndimg { |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
101
|
0
|
|
|
|
|
|
my $args = shift; |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return rand_image(%$args); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |