Utils/Each.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 90.2% 37 / 41 CC 3 SCAR 5.2
CC
3
Cov
94%
process
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Utils/Sort.pm ↑ Summary Utils/Printf.pm »
1 package Petal::Utils::Each;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base qw( Petal::Utils::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use constant name => 'each';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use constant aliases => qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
14 1 our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2];
15  
16 1 ▶sub process {
Subroutine process: called CC=3 SCAR=11.2
Pod undocumented
17 1 my $class = shift;
18 1 my $hash = shift;
19 1 ▶ my $args = shift || confess( "'each' expects a hash ref (got nothing)" );
Condition50%1/2
shift() || confess(q['each' expects a hash ref (got nothing)])
l!l
10
MC/DC0%0/1
shift() || confess(q['each' expects a hash ref (got nothing)])
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
20  
21 1 my $result = $hash->fetch( $args );
22  
23 1 ▶ confess( "1st arg to 'each' is not a hash ($args = $result)!" )
Branch: 1 branch
BranchTrueFalseTotal
unless ref $result eq "HASH" 0 1 1
24 unless ref($result) eq 'HASH';
25  
26 1 return [ map { { key => $_, val => $result->{$_} } } keys %$result ];
27 }
28  
29  
30 1 1;
31  
32 __END__
« Utils/Sort.pm ↑ Summary Utils/Printf.pm »