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   1768 use warnings;
  2         6  
  2         65  
2 2     2   10 use strict;
  2         4  
  2         56  
3              
4             package HTTP::Session::ID::MD5;
5 2     2   11 use Digest::MD5 ();
  2         4  
  2         24  
6 2     2   1003 use Time::HiRes ();
  2         2682  
  2         183  
7              
8             # Digest::MD5 was first released with perl 5.007003
9              
10             sub generate_id {
11 4     4 0 28 my ($class, $sid_length) = @_;
12 4   33     103 my $unique = $ENV{UNIQUE_ID} || ( [] . rand() );
13 4         84 return substr( Digest::MD5::md5_hex( Time::HiRes::gettimeofday() . $unique ), 0, $sid_length );
14             }
15              
16             1;