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 18     18   9270 use warnings;
  18         34  
  18         546  
2 18     18   103 use strict;
  18         31  
  18         470  
3              
4             package HTTP::Session::ID::SHA1;
5 18     18   7089 use Digest::SHA1 ();
  18         9560  
  18         356  
6 18     18   7483 use Time::HiRes ();
  18         18922  
  18         1645  
7              
8             sub generate_id {
9 41     41 0 304 my ($class, $sid_length) = @_;
10 41   66     854 my $unique = $ENV{UNIQUE_ID} || ( [] . rand() );
11 41         1114 return substr( Digest::SHA1::sha1_hex( Time::HiRes::gettimeofday() . $unique ), 0, $sid_length );
12             }
13              
14             1;