Utils/Decode.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 6 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 94.2% 49 / 52 CC 5 SCAR 9.8
CC
5
Cov
98%
process
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Utils.pm ↑ Summary Utils/Base.pm »
1 package Petal::Utils::Decode;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use base qw( Petal::Utils::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use constant name => 'decode';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use constant aliases => qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
14 4 our $REVISION = (split(/ /, ' $Revision: 1.3 $ '))[2];
15  
16 16 ▶sub process {
Subroutine process: called CC=5 SCAR=16.1
Pod undocumented
17 16 my $class = shift;
18 16 my $hash = shift;
19 16 ▶ my $args = shift || confess( "'decode' expects at least 1 variable (got nothing)!" );
Condition50%1/2
shift() || confess(q['decode' expects at least 1 variable (got nothing)!])
l!l
160
MC/DC0%0/1
shift() || confess(q['decode' expects at least 1 variable (got nothing)!])
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
20  
21 16 my @tokens = $class->split_args( $args );
22  
23 16 my $tvar = $class->fetch_arg($hash, shift @tokens);
24 4 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 16 ▶ while(@tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tokens) 21 3 24
26 21 my $a = $class->fetch_arg($hash, shift @tokens);
27 21 my $b = $class->fetch_arg($hash, shift @tokens);
28 21 ▶ return $a unless defined($b);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $b 6 15 21
29 15 ▶ return $b if ($tvar =~ /$a/);
Branch: 1 branch
BranchTrueFalseTotal
if $tvar =~ /$a/ 7 8 15
30 }
31 }
32  
33  
34  
35 4 1;
36  
37 __END__
« Utils.pm ↑ Summary Utils/Base.pm »