line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package KiokuDB::Role::UUIDs::SerialIDs; |
4
|
2
|
|
|
2
|
|
1285
|
use Moose::Role; |
|
2
|
|
|
|
|
412711
|
|
|
2
|
|
|
|
|
13
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9008
|
use namespace::clean -except => 'meta'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
19
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my $i = "0001"; # so that the first 10k objects sort lexically |
9
|
51
|
|
|
51
|
0
|
1088
|
sub generate_uuid { $i++ } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__ |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__END__ |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=pod |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
KiokuDB::Role::UUIDs::SerialIDs - Serial ID assignment based on a global |
20
|
|
|
|
|
|
|
counter. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# set before loading: |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
BEGIN { $KiokuDB::SERIAL_IDS = 1 } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use KiokuDB; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This role provides an alternate, development only ID generation role. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The purpose of this role is to ease testing when the database is created from |
35
|
|
|
|
|
|
|
scratch on each run. Objects will typically be assigned the same IDs between |
36
|
|
|
|
|
|
|
runs, making things easier to follow. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Do B<NOT> use this role for storage of actual data, because ID clashes are |
39
|
|
|
|
|
|
|
almost guaranteed to cause data loss. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |