File Coverage

blib/lib/HTTP/Session/ID/MD5.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition 1 3 33.3
subroutine 5 5 100.0
pod 0 1 0.0
total 21 24 87.5


line stmt bran cond sub pod time code
1 2     2   1532 use warnings;
  2         4  
  2         76  
2 2     2   11 use strict;
  2         4  
  2         82  
3              
4             package HTTP::Session::ID::MD5;
5 2     2   10 use Digest::MD5 ();
  2         3  
  2         26  
6 2     2   1910 use Time::HiRes ();
  2         4013  
  2         213  
7              
8             # Digest::MD5 was first released with perl 5.007003
9              
10             sub generate_id {
11 4     4 0 21 my ($class, $sid_length) = @_;
12 4   33     135 my $unique = $ENV{UNIQUE_ID} || ( [] . rand() . $$ );
13 4         82 return substr( Digest::MD5::md5_hex( Time::HiRes::gettimeofday() . $unique ), 0, $sid_length );
14             }
15              
16             1;