line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
20
|
|
|
20
|
|
8751
|
|
|
20
|
|
|
|
|
44
|
|
|
20
|
|
|
|
|
117
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo::Role; |
7
|
20
|
|
|
20
|
|
162
|
use namespace::clean; |
|
20
|
|
|
|
|
363
|
|
|
20
|
|
|
|
|
115
|
|
8
|
20
|
|
|
20
|
|
6502
|
|
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
144
|
|
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
|
|
|
|
|
|
|
|