BIBFRAME2MARC/Utils.pm

filter: Statementstmt 97.1% 34 / 35 Branchbran 66.6% 4 / 6 Conditioncond 55.5% 5 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 82.8% 53 / 64 CC 7 SCAR 15.0
CC
7
Cov
86%
list_versions
8.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.5
↑ Summary BIBFRAME2MARC.pm »
1 package NKC::Transform::BIBFRAME2MARC::Utils;
2  
3 3 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use File::Spec::Functions qw(catfile);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use File::Share ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 Readonly::Array our @EXPORT_OK => qw(list_versions);
13  
14 3 our $VERSION = 0.07;
15  
16 1 ▶sub list_versions {
Subroutine list_versions: called CC=7 SCAR=20.7
Pod documented
17 1 my $dir = shift;
18  
19 1 ▶ if (! defined $dir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $dir) 0 1 1
20 0 $dir = dist_dir('NKC-Transform-BIBFRAME2MARC');
21 }
22  
23 1 ▶ opendir(my $dh, $dir) or err "Cannot open directory.";
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, $dir or err("Cannot open directory.") 1 0 1
24 my @versions = sort {
25 4 my ($a1, $a2, $a3) = split m/\./ms, $a;
26 4 my ($b1, $b2, $b3) = split m/\./ms, $b;
27 4 ▶ $a1 <=> $b1 or $a2 <=> $b2 or $a3 <=> $b3;
Condition50%3/6
$a1 <=> $b1 || $a2 <=> $b2 || $a3 <=> $b3
l!l&&r!l&&!r
400
$a1 <=> $b1 or $a2 <=> $b2
l!l&&r!l&&!r
130
MC/DC0%0/3
$a1 <=> $b1 || $a2 <=> $b2 || $a3 <=> $b3
$a1 <=> $b1 $a2 <=> $b2 $a3 <=> $b3
Truth table50%2/4
A or B || C
A= $a1 <=> $b1B= $a2 <=> $b2C= $a3 <=> $b3
ABCresult
1XX1
01X1
0011
0000
28 }
29 1 ▶ map { -f catfile($dir, $_) && m/^bibframe2marc-(.+)\.xsl$/ms ? $1 : () }
Branch: 1 branch
BranchTrueFalseTotal
-f catfile($dir, $_) && /^bibframe2marc-(.+)\.xsl$/ms ? : 4 2 6
Condition66%2/3
-f catfile($dir, $_) and /^bibframe2marc-(.+)\.xsl$/ms
!ll&&!rl&&r
204
MC/DC50%1/2
-f catfile($dir, $_) and /^bibframe2marc-(.+)\.xsl$/ms
-f catfile($dir, $_) /^bibframe2marc-(.+)\.xsl$/ms
Truth table66%2/3
A and B
A= -f catfile($dir, $_)B= /^bibframe2marc-(.+)\.xsl$/ms
ABresult
0X0
100
111
30 readdir($dh);
31 1 closedir($dh);
32  
33 1 return @versions;
34 }
35  
36 3 1;
37  
38 __END__
↑ Summary BIBFRAME2MARC.pm »