GX/Session/ID/Generator/MD5.pm

filter: Statementstmt 100% 11 / 11 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 100% 24 / 24 CC 3 SCAR 6.9
CC
3
Cov
100%
validate_id
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« GX/Callback.pm ↑ Summary GX/Meta/Module.pm »
1 # ----------------------------------------------------------------------------------------------------------------------
2 # GX Framework (c) 2009-2011 Jörg A. Uzarek <uzarek@runlevelnull.de>
3 # File: GX/Session/ID/Generator/MD5.pm
4 # ----------------------------------------------------------------------------------------------------------------------
5  
6 package GX::Session::ID::Generator::MD5;
7  
8 2 ▶use Digest::MD5 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 # ----------------------------------------------------------------------------------------------------------------------
12 # Class setup
13 # ----------------------------------------------------------------------------------------------------------------------
14  
15 2 ▶use GX::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 extends 'GX::Session::ID::Generator';
18  
19 2 build;
20  
21  
22 # ----------------------------------------------------------------------------------------------------------------------
23 # Public methods
24 # ----------------------------------------------------------------------------------------------------------------------
25  
26 1 ▶sub generate_id {
Subroutine generate_id: called CC=1 SCAR=0.0
Pod documented
27  
28 1 return Digest::MD5::md5_hex( rand(), $_[0], time(), $$ );
29  
30 }
31  
32 5 ▶sub validate_id {
Subroutine validate_id: called CC=3 SCAR=11.0
Pod documented
33  
34 5 ▶ return defined $_[1] && $_[1] =~ /^[0-9a-fA-F]{32}$/ ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] && $_[1] =~ /^[0-9a-fA-F]{32}$/ ? : 1 4 5
Condition100%3/3
defined $_[1] and $_[1] =~ /^[0-9a-fA-F]{32}$/
!ll&&!rl&&r
131
MC/DC100%2/2
defined $_[1] and $_[1] =~ /^[0-9a-fA-F]{32}$/
defined $_[1] $_[1] =~ /^[0-9a-fA-F]{32}$/
Truth table100%3/3
A and B
A= defined $_[1]B= $_[1] =~ /^[0-9a-fA-F]{32}$/
ABresult
0X0
100
111
35  
36 }
37  
38  
39 2 1;
40  
41 __END__
« GX/Callback.pm ↑ Summary GX/Meta/Module.pm »