line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
22
|
|
|
22
|
|
10154
|
|
|
22
|
|
|
|
|
47
|
|
|
22
|
|
|
|
|
163
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo::Role; |
7
|
22
|
|
|
22
|
|
148
|
use namespace::clean; |
|
22
|
|
|
|
|
47
|
|
|
22
|
|
|
|
|
147
|
|
8
|
22
|
|
|
22
|
|
7371
|
|
|
22
|
|
|
|
|
49
|
|
|
22
|
|
|
|
|
116
|
|
9
|
|
|
|
|
|
|
requires 'generate'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=pod |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Catmandu::IdGenerator - A base role for identifier generators |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package MyGenerator; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Moo; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
with 'Catmandu::IdGenerator'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub generate { |
29
|
|
|
|
|
|
|
my ($self) = @_; |
30
|
|
|
|
|
|
|
return int(rand(999999)) . "-" . time; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package main; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $gen = MyGenerator->new; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
for (1..100) { |
38
|
|
|
|
|
|
|
printf "id: %s\n" m $gen->generate; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SEE ALSO |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
L<Catmandu::IdGenerator::Mock> , |
44
|
|
|
|
|
|
|
L<Catmandu::IdGenerator::UUID> |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |