File Coverage

blib/lib/KiokuDB/Role/UUIDs/SerialIDs.pm
Criterion Covered Total %
statement 2 4 50.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 4 6 66.6


line stmt bran cond sub pod time code
1             package KiokuDB::Role::UUIDs::SerialIDs;
2             BEGIN {
3 1     1   870 $KiokuDB::Role::UUIDs::SerialIDs::AUTHORITY = 'cpan:NUFFIN';
4             }
5             $KiokuDB::Role::UUIDs::SerialIDs::VERSION = '0.57';
6 1     1   378 use Moose::Role;
  0            
  0            
7             # ABSTRACT: Serial ID assignment based on a global counter.
8              
9             use namespace::clean -except => 'meta';
10              
11             my $i = "0001"; # so that the first 10k objects sort lexically
12             sub generate_uuid { $i++ }
13              
14             __PACKAGE__
15              
16             __END__
17              
18             =pod
19              
20             =encoding UTF-8
21              
22             =head1 NAME
23              
24             KiokuDB::Role::UUIDs::SerialIDs - Serial ID assignment based on a global counter.
25              
26             =head1 VERSION
27              
28             version 0.57
29              
30             =head1 SYNOPSIS
31              
32             # set before loading:
33              
34             BEGIN { $KiokuDB::SERIAL_IDS = 1 }
35              
36             use KiokuDB;
37              
38             =head1 DESCRIPTION
39              
40             This role provides an alternate, development only ID generation role.
41              
42             The purpose of this role is to ease testing when the database is created from
43             scratch on each run. Objects will typically be assigned the same IDs between
44             runs, making things easier to follow.
45              
46             Do B<NOT> use this role for storage of actual data, because ID clashes are
47             almost guaranteed to cause data loss.
48              
49             =head1 AUTHOR
50              
51             Yuval Kogman <nothingmuch@woobling.org>
52              
53             =head1 COPYRIGHT AND LICENSE
54              
55             This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.
56              
57             This is free software; you can redistribute it and/or modify it under
58             the same terms as the Perl 5 programming language system itself.
59              
60             =cut