line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::LUID; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24243
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Data::LUID - Generate guaranteed unique local identifiers |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.014 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.014'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Data::LUID::Table |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $table = Data::LUID::Table->new( path => 'luid' ) |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$luid = $table->make |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
A sample run: |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
8bqwv1 |
29
|
|
|
|
|
|
|
kb3c6e |
30
|
|
|
|
|
|
|
9tah65 |
31
|
|
|
|
|
|
|
5fd7rd |
32
|
|
|
|
|
|
|
tss74z |
33
|
|
|
|
|
|
|
7rxk5s |
34
|
|
|
|
|
|
|
3mv3qb |
35
|
|
|
|
|
|
|
2ad9qj |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
On each call to C<< ->make >>, Data::LUID::Table will generate a guaranteed unique local identifier. Guaranteed because once each |
40
|
|
|
|
|
|
|
identifier is generated, it will be stored in a table for future lookup (collision avoidance) |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
The current backend is L<BerkeleyDB> |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 USAGE |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 $table = Data::LUID::Table->new( path => <path> ) |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Create a new Data::LUID::Table, saving the table to disk at the given <path> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
The <path> argument (default: C<./luid>) is the location of the table on disk |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 $luid = $table->make |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 $luid = $table->next |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Generate the next luid in the sequence |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
The current generator is L<Data::TUID>, so there is no real "sequence" per se |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L<Data::TUID> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Robert Krimen, C<< <rkrimen at cpan.org> >> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 BUGS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-data-luid at rt.cpan.org>, or through |
71
|
|
|
|
|
|
|
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-LUID>. I will be notified, and then you'll |
72
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SUPPORT |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
perldoc Data::LUID |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
You can also look for information at: |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over 4 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-LUID> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
L<http://annocpan.org/dist/Data-LUID> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * CPAN Ratings |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/Data-LUID> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * Search CPAN |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/Data-LUID/> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Copyright 2009 Robert Krimen, all rights reserved. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
115
|
|
|
|
|
|
|
under the same terms as Perl itself. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; # End of Data::LUID |