File Coverage

blib/lib/Salvation/TC/Type/SessionId.pm
Criterion Covered Total %
statement 12 14 85.7
branch 0 2 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 25 68.0


line stmt bran cond sub pod time code
1             package Salvation::TC::Type::SessionId;
2              
3             # $Id: SessionId.pm 6868 2014-06-03 10:59:59Z trojn $
4              
5 4     4   1537 use strict;
  4         6  
  4         116  
6 4     4   15 use warnings;
  4         4  
  4         110  
7              
8 4     4   16 use base 'Salvation::TC::Type';
  4         4  
  4         228  
9              
10 4     4   21 use Salvation::TC::Exception::WrongType ();
  4         6  
  4         396  
11              
12             my $re = qr/^[A-Za-z0-9]{32}$/;
13              
14             sub Check {
15              
16 0     0 1   my ( $class, $session_id ) = @_;
17              
18 0 0 0       ( defined( $session_id ) && $session_id =~ $re ) ||
19             Salvation::TC::Exception::WrongType -> throw( 'type' => 'SessionId', 'value' => $session_id, '-text' => 'Wrong type for "session_id".' );
20             }
21              
22             1;
23             __END__