lib/POE/Component/MessageQueue/IDGenerator/UUID.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 94.1% 16 / 17 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
__ANON__
1.0
CRAP 1.0
« lib/POE/Component/Server/Stomp.pm ↑ Summary lib/POE/Component/MessageQueue/Destination.pm »
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 16 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 16 with qw(POE::Component::MessageQueue::IDGenerator);
21  
22 16 ▶use Data::UUID;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 has 'generator' => (
25 is => 'ro',
26 4 ▶ default => sub { Data::UUID->new() },
Subroutine __ANON__: called CC=1 SCAR=0.0
27 16 );
28  
29 sub generate
30 {
31 150 ▶ my ($self) = @_;
Subroutine generate: called CC=1 SCAR=0.0
Pod undocumented
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 return $self->generator->create_str();
36 }
37  
38 16 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>
« lib/POE/Component/Server/Stomp.pm ↑ Summary lib/POE/Component/MessageQueue/Destination.pm »