line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
20
|
|
|
20
|
|
9434
|
|
|
20
|
|
|
|
|
44
|
|
|
20
|
|
|
|
|
130
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo::Role; |
7
|
20
|
|
|
20
|
|
139
|
use namespace::clean; |
|
20
|
|
|
|
|
365
|
|
|
20
|
|
|
|
|
129
|
|
8
|
20
|
|
|
20
|
|
7003
|
|
|
20
|
|
|
|
|
48
|
|
|
20
|
|
|
|
|
108
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::IdGenerator'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=pod |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Catmandu::Bag::IdGenerator - A base role for bag identifier generators |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package MyGenerator; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Moo; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
with 'Catmandu::Bag::IdGenerator'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub generate { |
29
|
|
|
|
|
|
|
my ($self, $bag) = @_; |
30
|
|
|
|
|
|
|
return $bag->name . "-" . int(ran(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 |
47
|
|
|
|
|
|
|
|