File Coverage

blib/lib/Workflow/Persister/UUID.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 27 27 100.0


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