File Coverage

blib/lib/MARC/File/Encode.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package MARC::File::Encode;
2              
3             =head1 NAME
4              
5             MARC::File::Encode - Encode wrapper for MARC::Record
6              
7             =head1 DESCRIPTION
8              
9             Encode.pm exports encode() by default, and MARC::File::USMARC
10             already has a function encode() so we need this wrapper to
11             keep things the way they are. I was half tempted to change
12             MARC::File::USMARC::encode() to something else but there could
13             very well be code in the wild that uses it directly and I don't
14             want to break backwards compat. This probably comes with a performance
15             hit of some kind.
16              
17             =cut
18              
19 28     28   172 use strict;
  28         61  
  28         664  
20 28     28   142 use warnings;
  28         99  
  28         671  
21 28     28   139 use base qw( Exporter );
  28         58  
  28         2256  
22 28     28   14475 use Encode;
  28         229047  
  28         3081  
23              
24             our @EXPORT_OK = qw( marc_to_utf8 );
25              
26             =head2 marc_to_utf8()
27              
28             Simple wrapper around Encode::decode().
29              
30             =cut
31              
32             sub marc_to_utf8 {
33             # if there is invalid utf8 date then this will through an exception
34             # let's just hope it's valid :-)
35 1     1 1 6 return decode( 'UTF-8', $_[0], 1 );
36             }
37              
38             1;