File Coverage

lib/Workflow/Persister/UUID.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 3 3 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Workflow::Persister::UUID;
2              
3 1     1   3309 use warnings;
  1         2  
  1         49  
4 1     1   6 use strict;
  1         1  
  1         28  
5 1     1   6 use Data::UUID;
  1         1  
  1         201  
6              
7             $Workflow::Persister::UUID::VERSION = '1.62';
8              
9             sub new {
10 1     1 1 629 my ( $class, $params ) = @_;
11 1         691 my $self = bless { gen => Data::UUID->new() }, $class;
12 1         7 return $self;
13             }
14              
15             sub pre_fetch_id {
16 2     2 1 2781 my ( $self, $dbh ) = @_;
17 2         120 return $self->{gen}->create_str();
18             }
19              
20 1     1 1 417 sub post_fetch_id {return}
21              
22             1;
23              
24             __END__
25              
26             =pod
27              
28             =head1 NAME
29              
30             Workflow::Persister::UUID - Persister to generate Universally Unique Identifiers
31              
32             =head1 VERSION
33              
34             This documentation describes version 1.62 of this package
35              
36             =head1 SYNOPSIS
37              
38             <persister
39             name="MyPersister"
40             use_uuid="yes"
41             ...
42              
43             =head1 DESCRIPTION
44              
45             Implementation for any persister to generate a UUID/GUID ID
46             string. The resulting string is 36 characters long and, according to
47             the implementation docs, "is guaranteed to be different from all other
48             UUIDs/GUIDs generated until 3400 CE."
49              
50             This uses the L<Data::UUID> module to generate the UUID string, so
51             look there if you are curious about the algorithm, efficiency, etc.
52              
53             =head2 METHODS
54              
55             =head3 new
56              
57             Instantiates a Workflow::Persister::UUID object, which is actually an
58             encapsulation of L<Data::UUID>.
59              
60             =head3 pre_fetch_id
61              
62             L</pre_fetch_id> can then be used to generate/retrieve a unique ID, generated
63             by L<Data::UUID>.
64              
65             =head3 post_fetch_id
66              
67             This method is unimplemented at this time, please see the TODO.
68              
69             =head1 TODO
70              
71             =over
72              
73             =item * Implement L</post_fetch_id>
74              
75             =back
76              
77             =head1 SEE ALSO
78              
79             =over
80              
81             =item L<Data::UUID>
82              
83             =back
84              
85             =head1 COPYRIGHT
86              
87             Copyright (c) 2003-2023 Chris Winters. All rights reserved.
88              
89             This library is free software; you can redistribute it and/or modify
90             it under the same terms as Perl itself.
91              
92             Please see the F<LICENSE>
93              
94             =head1 AUTHORS
95              
96             Please see L<Workflow>
97              
98             =cut