Utils/Create_Href.pm

filter: Statementstmt 100% 33 / 33 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 4 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 88.8% 48 / 54 CC 6 SCAR 12.7
CC
6
Cov
93%
process
6.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« Utils/Limit.pm ↑ Summary Utils/Like.pm »
1 package Petal::Utils::Create_Href;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use base qw( Petal::Utils::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶use constant name => 'create_href';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use constant aliases => qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
14 3 our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2];
15  
16 4 ▶sub process {
Subroutine process: called CC=6 SCAR=18.1
Pod undocumented
17 4 my $class = shift;
18 4 my $hash = shift;
19 4 ▶ my $args = shift || confess( "'create_href' expects 1 or 2 variables (got nothing)!" );
Condition50%1/2
shift() || confess(q['create_href' expects 1 or 2 variables (got nothing)!])
l!l
40
MC/DC0%0/1
shift() || confess(q['create_href' expects 1 or 2 variables (got nothing)!])
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
20  
21 4 my @args = $class->split_args( $args );
22 4 ▶ my $key = $args[0] || confess( "1st arg to 'limit' should be a variable (got nothing)!" );
Condition50%1/2
$args[0] || confess(q[1st arg to 'limit' should be a variable (got nothing)!])
l!l
40
MC/DC0%0/1
$args[0] || confess(q[1st arg to 'limit' should be a variable (got nothing)!])
$args[0]
Truth table50%1/2
A
A= $args[0]
Aresult
11
00
23 4 ▶ my $protocol = $args[1] || 'http';
Condition100%2/2
$args[1] || 'http'
l!l
22
MC/DC100%1/1
$args[1] || 'http'
$args[1]
Truth table100%2/2
A
A= $args[1]
Aresult
11
00
24  
25 4 my $href = $hash->fetch($key);
26 4 ▶ unless ($href =~ /^$protocol:/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($href =~ /^$protocol:/) 2 2 4
27 2 $protocol = "$protocol://";
28 2 ▶ $protocol .= '/' if $protocol =~ /file/i;
Branch: 1 branch
BranchTrueFalseTotal
if $protocol =~ /file/i 0 2 2
29 2 $href = $protocol . $href;
30 }
31 4 return $href;
32  
33 }
34  
35 3 1;
36  
37 __END__
« Utils/Limit.pm ↑ Summary Utils/Like.pm »