File Coverage

blib/lib/UUID/Random.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 17 18 94.4


line stmt bran cond sub pod time code
1             package UUID::Random;
2              
3             require 5.006_001;
4 2     2   49072 use strict;
  2         4  
  2         77  
5 2     2   9 use warnings;
  2         4  
  2         334  
6              
7              
8             our $VERSION = '0.04';
9              
10             sub generate {
11 1     1 0 12 my @chars = ('a'..'f',0..9);
12 1         2 my @string;
13 1         86 push(@string, $chars[int(rand(16))]) for(1..32);
14 1         4 splice(@string,8,0,'-');
15 1         4 splice(@string,13,0,'-');
16 1         2 splice(@string,18,0,'-');
17 1         2 splice(@string,23,0,'-');
18 1         13 return join('', @string);
19             }
20              
21             1;
22             __END__