File Coverage

blib/lib/Object/InsideOut/Secure.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 26 26 100.0


line stmt bran cond sub pod time code
1             package Object::InsideOut::Secure; {
2 1     1   4 use strict;
  1         1  
  1         23  
3 1     1   3 use warnings;
  1         1  
  1         43  
4              
5             our $VERSION = '4.03';
6             $VERSION = eval $VERSION;
7              
8 1     1   3 use Object::InsideOut 4.03 ':hash_only';
  1         13  
  1         12  
9              
10             # Holds used IDs
11             my %used :Field = ( 0 => undef );
12              
13             # Our PRNG
14             BEGIN {
15 1     1   25 $Math::Random::MT::Auto::shared = $threads::shared::threads_shared;
16             }
17 1     1   4 use Math::Random::MT::Auto 5.04 ':!auto';
  1         15  
  1         4  
18             my $prng = Math::Random::MT::Auto->new();
19              
20             # Assigns random IDs
21             sub _id :ID
22             {
23 1         2 my $id;
24 1         10 while (exists($used{$id = $prng->irand()})) {}
25 1         3 $used{$id} = undef;
26 1         4 return $id;
27 1     1   5 }
  1         1  
  1         3  
28             }
29              
30             1;
31              
32             # EOF