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

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