KiokuDB/Role/UUIDs.pm

filter: Statementstmt 94.1% 16 / 17 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 89.6% 26 / 29 CC 1 SCAR 0.1
CC
1
Cov
88%
__ANON__
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« KiokuDB/TypeMap/Entry/Naive.pm ↑ Summary KiokuDB/TypeMap/Entry/Std/Compile.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::Role::UUIDs;
4 21 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 21 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 21 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 21 ▶if ( defined &KiokuDB::SERIAL_IDS and KiokuDB::SERIAL_IDS() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &KiokuDB::SERIAL_IDS and 0) { } 1 20 21
Condition66%2/3
defined &KiokuDB::SERIAL_IDS and !!0
!ll
9120
MC/DC100%1/1
defined &KiokuDB::SERIAL_IDS and !!0
defined &KiokuDB::SERIAL_IDS
Truth table100%2/2
A
A= defined &KiokuDB::SERIAL_IDS
Aresult
00
11
11 1 with qw(KiokuDB::Role::UUIDs::SerialIDs);
12 } else {
13 20 ▶ my $have_libuuid = try { require Data::UUID::LibUUID; 1 };
Subroutine __ANON__: called CC=1 SCAR=0.4
14  
15 20 ▶ my $backend = $have_libuuid ? "LibUUID" : "DataUUID";
Branch: 1 branch
BranchTrueFalseTotal
$have_libuuid ? : 0 20 20
16  
17 20 with "KiokuDB::Role::UUIDs::$backend";
18 }
19  
20 21 __PACKAGE__
21  
22 __END__
23  
24 =pod
25  
26 =head1 NAME
27  
28 KiokuDB::Role::UUIDs - UUID generation role.
29  
30 =head1 SYNOPSIS
31  
32 with qw(KiokuDB::Role::UUIDs);
33  
34 =head1 DESCRIPTION
35  
36 This role provides UUID assignment.
37  
38 Depending on the C<$SERIAL_IDS> variable being true at compile time, and
39 availability of UUID generation module (L<Data::UUID::LibUUID> falling back to
40 L<Data::UUID>) an implementation role is selected.
41  
42 =head1 METHODS
43  
44 =over 4
45  
46 =item generate_uuid
47  
48 Create a new UUID
49  
50 =back
51  
52 =cut
« KiokuDB/TypeMap/Entry/Naive.pm ↑ Summary KiokuDB/TypeMap/Entry/Std/Compile.pm »