Licence/Validate.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 60.0% 6 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 86.6% 39 / 45 SCAR 18.0
CC
6
Cov
87%
valid
6.3
BEGIN
1.0
BEGIN
1.0
CRAP 6.1
« Licence.pm ↑ Summary Licence/Generate.pm »
1 package Enterprise::Licence::Validate;
2 1 ▶use utf8; use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use parent 'Enterprise::Licence';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 sub valid {
5 2 ▶ my ($rs, $ns, $es, $ds) = split '-', $_[1];
Subroutine valid: called CC=6 SCAR=18.3
Pod undocumented
6 2 $rs =~ s/(_*)$//;
7 2 my $lc = $_[0]->in($rs) - $_[0]->bin2dec($_[0]->customer_offset($_[2]));
8 2 ▶ if ($lc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lc) 2 0 2
9 2 my $bin = $_[0]->dec2bin($lc);
10 2 $bin = (0 x length $1) . $bin;
11 2 my $recovered = $_[0]->{ch}->decode($bin);
12 2 ▶ if ($recovered) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recovered) 2 0 2
13 2 my $sec = join("", @$recovered);
14 2 ▶ if ($_[0]->{secret} eq $sec) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"secret"} eq $sec) 2 0 2
15 2 my ($ltime, $etime, $dtime) = ($_[0]->in($ns), $_[0]->in($es), $_[0]->in($ds));
16 2 ▶ if (($etime - $ltime) == $dtime) {
Branch: 1 branch
BranchTrueFalseTotal
if ($etime - $ltime == $dtime) 2 0 2
17 2 ▶ if ( $etime > time) {
Branch: 1 branch
BranchTrueFalseTotal
if ($etime > time) 1 1 2
18 1 return 1;
19 }
20 1 return (0, 1);
21 }
22 }
23 }
24 }
25 0 return (0, 0);
26 }
27 1 1;
« Licence.pm ↑ Summary Licence/Generate.pm »