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   18879 use warnings;
  18         40  
  18         659  
2 18     18   102 use strict;
  18         31  
  18         858  
3              
4             package HTTP::Session::ID::SHA1;
5 18     18   14007 use Digest::SHA1 ();
  18         16346  
  18         398  
6 18     18   18698 use Time::HiRes ();
  18         35361  
  18         1954  
7              
8             sub generate_id {
9 41     41 0 316 my ($class, $sid_length) = @_;
10 41   66     1153 my $unique = $ENV{UNIQUE_ID} || ( [] . rand() . $$ );
11 41         1059 return substr( Digest::SHA1::sha1_hex( Time::HiRes::gettimeofday() . $unique ), 0, $sid_length );
12             }
13              
14             1;