| 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)!])
MC/DC0%0/1
shift() || confess(q['create_href' expects 1 or 2 variables (got nothing)!])
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 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)!])
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]
| |||||||||||||
| 23 | 4 | ▶ | my $protocol = $args[1] || 'http'; | ||||||||||
|
Condition100%2/2
$args[1] || 'http'
MC/DC100%1/1
$args[1] || 'http'
$args[1]
Truth table100%2/2
A
A= $args[1]
| |||||||||||||
| 24 | |||||||||||||
| 25 | 4 | my $href = $hash->fetch($key); | |||||||||||
| 26 | 4 | ▶ | unless ($href =~ /^$protocol:/) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 27 | 2 | $protocol = "$protocol://"; | |||||||||||
| 28 | 2 | ▶ | $protocol .= '/' if $protocol =~ /file/i; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 29 | 2 | $href = $protocol . $href; | |||||||||||
| 30 | } | ||||||||||||
| 31 | 4 | return $href; | |||||||||||
| 32 | |||||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 3 | 1; | |||||||||||
| 36 | |||||||||||||
| 37 | __END__ | ||||||||||||