line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
22
|
|
|
22
|
|
10495
|
|
|
22
|
|
|
|
|
55
|
|
|
22
|
|
|
|
|
145
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo::Role; |
7
|
22
|
|
|
22
|
|
147
|
use namespace::clean; |
|
22
|
|
|
|
|
51
|
|
|
22
|
|
|
|
|
140
|
|
8
|
22
|
|
|
22
|
|
7643
|
|
|
22
|
|
|
|
|
50
|
|
|
22
|
|
|
|
|
127
|
|
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 |