line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooX::Keyword::Random; |
2
|
2
|
|
|
2
|
|
276448
|
use 5.006; use strict; use warnings; |
|
2
|
|
|
2
|
|
10
|
|
|
2
|
|
|
2
|
|
12
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
64
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
2
|
|
|
2
|
|
588
|
use Moo; |
|
2
|
|
|
|
|
11932
|
|
|
2
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
use MooX::Keyword { |
6
|
|
|
|
|
|
|
random => { |
7
|
|
|
|
|
|
|
builder => sub { |
8
|
3
|
|
|
|
|
2919
|
my ($moo, $name, $random) = @_; |
9
|
3
|
|
|
|
|
78
|
$moo->has($name, is => 'rw'); |
10
|
3
|
100
|
66
|
|
|
21845
|
if (!ref $random && $random =~ m/\d+/) { |
11
|
1
|
|
|
|
|
5
|
$random = [ 0 .. $random + 1 ]; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
$moo->around($name, sub { |
14
|
3
|
|
|
|
|
3086
|
my ($orig, $self, @args) = @_; |
15
|
3
|
|
|
|
|
6
|
return $random->[int(rand(scalar @{$random}))]; |
|
3
|
|
|
|
|
54
|
|
16
|
3
|
|
|
|
|
85
|
}); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
} |
19
|
2
|
|
|
2
|
|
2659
|
}; |
|
2
|
|
|
|
|
12428
|
|
|
2
|
|
|
|
|
28
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
MooX::Keyword::Random - return a random result! |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 VERSION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Version 0.01 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Quick summary of what the module does. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Perhaps a little code snippet. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package Holiday::Hospital; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Moo; |
42
|
|
|
|
|
|
|
use MooX::Keyword extends => '+Random'; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
random bed => 21; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
random doctorse => ['a' .. 'z']; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
random food => [ 'pizza', 'burger', 'kebab', 'fruit', 'toast' ]; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
... |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $h = Holiday::Hospital->new(); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $room = $h->bed(); # a random number between 0 and 21. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
LNATION, C<< >> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 BUGS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
65
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
66
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SUPPORT |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
perldoc MooX::Keyword::Random |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
You can also look for information at: |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over 4 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * CPAN Ratings |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * Search CPAN |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by LNATION. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software, licensed under: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; # End of MooX::Keyword::Random |