| 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.04; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | sub list_versions { | ||||||||||||||||||||||||||||
| 17 | 1 | ▶ | my $dir = shift; | ||||||||||||||||||||||||||
|
Subroutine
list_versions: called CC=7 SCAR=20.4
Pod
documented
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | if (! defined $dir) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | $dir = dist_dir('NKC-Transform-BIBFRAME2MARC'); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | opendir(my $dh, $dir) or err "Cannot open directory."; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$a1 <=> $b1 or $a2 <=> $b2
MC/DC0%0/2
$a1 <=> $b1 or $a2 <=> $b2
$a1 <=> $b1
$a2 <=> $b2
Truth table66%2/3
A or B
A= $a1 <=> $b1B= $a2 <=> $b2
| |||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | 1 | ▶ | map { -f catfile($dir, $_) && m/^bibframe2marc-(.+)\.xsl$/ms ? $1 : () } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-f catfile($dir, $_) and /^bibframe2marc-(.+)\.xsl$/ms
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
| |||||||||||||||||||||||||||||
| 30 | readdir($dh); | ||||||||||||||||||||||||||||
| 31 | 1 | closedir($dh); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | return @versions; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 3 | 1; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | __END__ | ||||||||||||||||||||||||||||