line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Copyright 2007, 2008 Paul Driver <frodwith@gmail.com> |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify |
5
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
6
|
|
|
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or |
7
|
|
|
|
|
|
|
# (at your option) any later version. |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
10
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
|
|
|
|
# GNU General Public License for more details. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
15
|
|
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package POE::Component::MessageQueue::IDGenerator::UUID; |
19
|
11
|
|
|
11
|
|
74
|
use Moose; |
|
11
|
|
|
|
|
81
|
|
|
11
|
|
|
|
|
91
|
|
20
|
|
|
|
|
|
|
with qw(POE::Component::MessageQueue::IDGenerator); |
21
|
|
|
|
|
|
|
|
22
|
11
|
|
|
11
|
|
75750
|
use Data::UUID; |
|
11
|
|
|
|
|
6382
|
|
|
11
|
|
|
|
|
1368
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'generator' => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
default => sub { Data::UUID->new() }, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub generate |
30
|
|
|
|
|
|
|
{ |
31
|
150
|
|
|
150
|
0
|
2048
|
my ($self) = @_; |
32
|
|
|
|
|
|
|
# We could return something more compact (like a b64string) but that would |
33
|
|
|
|
|
|
|
# screw with Storage::Filesystem, and anyone else that doesn't like special |
34
|
|
|
|
|
|
|
# characters. |
35
|
150
|
|
|
|
|
5184
|
return $self->generator->create_str(); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
POE::Component::MessageQueue::IDGenerator::UUID - UUID generator. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This is a concrete implementation of the Generator interface for creating |
47
|
|
|
|
|
|
|
message IDs. It uses standards compliant UUIDs, which according to Data::UUID |
48
|
|
|
|
|
|
|
are guaranteed to be unique until 3500 C.E., though I'm not sure how it knows |
49
|
|
|
|
|
|
|
that. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SEE ALSO |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
L<Data::UUID> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Paul Driver <frodwith@gmail.com> |