blib/lib/NKC/Transform/MARC2RDA.pm

filter: Statementstmt 88.8% 16 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 91.6% 22 / 24 CC 1 SCAR 0.5
CC
1
Cov
89%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package NKC::Transform::MARC2RDA;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Class::Utils qw(set_params);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use File::Share ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Perl6::Slurp qw(slurp);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use XML::Saxon::XSLT3;
Subroutine BEGIN: called CC=1 SCAR=2.6
10  
11 our $VERSION = 0.01;
12  
13 sub new {
14 my ($class, @params) = @_;
15  
16 # Create object.
17 my $self = bless {}, $class;
18  
19 # XSLT transformation file.
20 $self->{'xslt_transformation_dir'} = dist_dir('NKC-Transform-MARC2RDA').'/';
21 $self->{'xslt_transformation_file'} = dist_file('NKC-Transform-MARC2RDA', 'm2r.xsl');
22  
23 # Process parameters.
24 set_params($self, @params);
25  
26 return $self;
27 }
28  
29 sub transform {
30 my ($self, $marc_xml) = @_;
31  
32 my $xslt = slurp($self->{'xslt_transformation_file'});
33  
34 my $trans = XML::Saxon::XSLT3->new($xslt, $self->{'xslt_transformation_dir'});
35 my $output = $trans->transform($marc_xml);
36  
37 return $trans->transform($marc_xml);;
38 }
39  
40 1;
↑ Summary