File Coverage

blib/lib/HTTP/Session/ID/SHA1.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition 2 3 66.6
subroutine 5 5 100.0
pod 0 1 0.0
total 22 24 91.6


line stmt bran cond sub pod time code
1 19     19   289181 use warnings;
  19         71  
  19         1658  
2 19     19   141 use strict;
  19         38  
  19         946  
3              
4             package HTTP::Session::ID::SHA1;
5 19     19   9968 use Digest::SHA1 ();
  19         15623  
  19         637  
6 19     19   127 use Time::HiRes ();
  19         36  
  19         2637  
7              
8             sub generate_id {
9 42     42 0 408 my ($class, $sid_length) = @_;
10 42   66     1401 my $unique = $ENV{UNIQUE_ID} || ( [] . rand() . $$ );
11 42         1926 return substr( Digest::SHA1::sha1_hex( Time::HiRes::gettimeofday() . $unique ), 0, $sid_length );
12             }
13              
14             1;