MARC::File::Encode - Encode wrapper for MARC::Record


MARC-Record documentation Contained in the MARC-Record distribution.

Index


Code Index:

NAME

Top

MARC::File::Encode - Encode wrapper for MARC::Record

DESCRIPTION

Top

Encode.pm exports encode() by default, and MARC::File::USMARC already has a function encode() so we need this wrapper to keep things the way they are. I was half tempted to change MARC::File::USMARC::encode() to something else but there could very well be code in the wild that uses it directly and I don't want to break backwards compat. This probably comes with a performance hit of some kind.

marc_to_utf8()

Simple wrapper around Encode::decode().


MARC-Record documentation Contained in the MARC-Record distribution.
package MARC::File::Encode;

use strict;
use warnings;
use base qw( Exporter );
use Encode;

our @EXPORT_OK = qw( marc_to_utf8 );

sub marc_to_utf8 {
    # if there is invalid utf8 date then this will through an exception
    # let's just hope it's valid :-)
    return decode( 'UTF-8', $_[0], 1 );
}

1;