File Coverage

blib/lib/UUID/Generator/PurePerl/RNG.pm
Criterion Covered Total %
statement 16 17 94.1
branch 4 6 66.6
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 24 29 82.7


line stmt bran cond sub pod time code
1             package UUID::Generator::PurePerl::RNG;
2              
3 11     11   602 use strict;
  11         12  
  11         268  
4 11     11   37 use warnings;
  11         12  
  11         1409  
5              
6             my $singleton;
7             sub singleton {
8 1     1 0 3 my $class = shift;
9              
10 1 50       5 if (! defined $singleton) {
11 1         4 $singleton = $class->new(@_);
12             }
13              
14 1         5 return $singleton;
15             }
16              
17             sub new {
18 3     3 0 12 shift; # class
19              
20 3         12 my @classes = qw(
21             UUID::Generator::PurePerl::RNG::MRMT
22             UUID::Generator::PurePerl::RNG::MRMTPP
23             UUID::Generator::PurePerl::RNG::rand
24             );
25              
26 3         6 foreach my $class (@classes) {
27 9 50       560 next if ! eval qq{ require $class };
28              
29 9 100       74 next if ! $class->enabled;
30              
31 3         11 return $class->new();
32             }
33              
34 0           return;
35             }
36              
37             1;
38             __END__