| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
|
3
|
2
|
|
|
2
|
|
85906
|
|
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
|
7
|
2
|
|
|
2
|
|
11
|
use Catmandu::Util qw(check_natural); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
9
|
|
|
8
|
2
|
|
|
2
|
|
583
|
use namespace::clean; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
102
|
|
|
9
|
2
|
|
|
2
|
|
11
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
8
|
|
|
10
|
|
|
|
|
|
|
with 'Catmandu::IdGenerator'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has first_id => |
|
13
|
|
|
|
|
|
|
(is => 'ro', isa => sub {check_natural($_[0])}, default => sub {0},); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has next_id => |
|
16
|
|
|
|
|
|
|
(is => 'rwp', init_arg => undef, lazy => 1, builder => 'first_id',); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my ($self) = @_; |
|
19
|
|
|
|
|
|
|
my $id = $self->next_id; |
|
20
|
30
|
|
|
30
|
0
|
1390
|
$self->_set_next_id($id + 1); |
|
21
|
30
|
|
|
|
|
378
|
$id; |
|
22
|
30
|
|
|
|
|
180
|
} |
|
23
|
30
|
|
|
|
|
68
|
|
|
24
|
|
|
|
|
|
|
1; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Catmandu::IdGenerator::Mock - Generator of increasing identifiers |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use Catmandu::IdGenerator::Mock; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $x = Catmandu::IdGenerator::Mock->new(first_id => 10); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
for (1..100) { |
|
40
|
|
|
|
|
|
|
printf "id: %s\n" m $x->generate; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This L<Catmandu::IdGenerator> generates identifiers based on the sequence of |
|
46
|
|
|
|
|
|
|
natural numbers. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 CONFIGURATION |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item first_id |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
First number to start from. Set to C<0> by default (zero-based numbering). |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |