blib/lib/Shipwright/Backend.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 93.3% 42 / 45 CC 6 SCAR 13.9
CC
6
Cov
92%
new
6.1
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« blib/lib/Shipwright/Source/FTP.pm ↑ Summary blib/lib/Shipwright/Logger.pm »
1 package Shipwright::Backend;
2  
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use UNIVERSAL::require;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use Shipwright::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 17 ▶sub new {
Subroutine new: called CC=6 SCAR=18.0
Pod documented
9 17 my $class = shift;
10 17 my %args = @_;
11  
12 17 ▶ confess_or_die 'need repository arg' unless exists $args{repository};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args{"repository"} 1 16 17
13  
14 16 $args{repository} =~ s/^\s+//;
15 16 $args{repository} =~ s/\s+$//;
16  
17 # exception for svk repos, they can start with //
18 16 ▶ if ( $args{repository} =~ m{^//} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"repository"} =~ m[^//]) 1 15 16
19 1 $args{repository} = 'svk:'. $args{repository};
20 }
21  
22 16 my $backend;
23 16 ▶ if ( $args{repository} =~ /^([a-z]+)(?:\+([a-z]+))?:/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'repository'} =~ /^([a-z]+)(?:\+([a-z]+))?:/) { } 12 4 16
24 12 ($backend) = $1;
25 } else {
26 4 confess_or_die "invalid repository, doesn't start with xxx: or xxx+yyy:";
27 }
28  
29 12 my $module = find_module(__PACKAGE__, $backend);
30 12 ▶ unless ( $module ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($module) 0 12 12
31 0 confess_or_die "Couldn't find backend implementing '$backend'";
32 }
33  
34 $module->require
35 12 ▶ or confess_or_die "Couldn't load module '$module'"
Branch: 1 branch
BranchTrueFalseTotal
$module->require or confess_or_die("Couldn't load module '${module}'" . " implementing backend '${backend}': $@") 12 0 12
36 ." implementing backend '$backend': $@";
37 12 return $module->new(%args);
38 }
39  
40 6 1;
41  
42 __END__
« blib/lib/Shipwright/Source/FTP.pm ↑ Summary blib/lib/Shipwright/Logger.pm »