blib/lib/CGI/Application/Plugin/Authentication/Driver/Filter/crypt.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 94.1% 32 / 34 CC 4 SCAR 7.7
CC
4
Cov
93%
filter
3.0
check
2.0
BEGIN
1.0
CRAP 2.2
« blib/lib/CGI/Application/Plugin/Authentication/Store/Cookie.pm ↑ Summary blib/lib/CGI/Application/Plugin/Authentication/Store/Session.pm »
1 package CGI::Application::Plugin::Authentication::Driver::Filter::crypt;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 sub check {
7 2 ▶ my $class = shift;
Subroutine check: called CC=2 SCAR=6.9
Pod documented
8 2 my $param = shift;
9 2 my $plain = shift;
10 2 my $filtered = shift;
11  
12 2 ▶ return ( $class->filter( $param, $plain, $filtered ) eq $filtered ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$class->filter($param, $plain, $filtered) eq $filtered ? : 1 1 2
13 }
14  
15 sub filter {
16 20 ▶ my $class = shift;
Subroutine filter: called CC=3 SCAR=11.1
Pod documented
17 20 my $param = lc shift;
18 20 ▶ if (!defined $param) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $param) 0 20 20
19 0 $param = 'hex';
20 }
21 20 my $plain = shift;
22 20 my $salt = shift;
23 20 ▶ if (!$salt) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($salt) 13 7 20
24 13 my @alphabet = ( '.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z' );
25 13 $salt = join '', @alphabet[ rand 64, rand 64 ];
26 }
27 20 return crypt( $plain, $salt );
28 }
29  
30 4 1;
31 __END__
« blib/lib/CGI/Application/Plugin/Authentication/Store/Cookie.pm ↑ Summary blib/lib/CGI/Application/Plugin/Authentication/Store/Session.pm »