NAME

MARC::Loader - Perl extension for creating MARC record from a hash

VERSION

Version 0.002001

SYNOPSIS

use MARC::Loader;
my $foo={
	'ldr' => 'optionnal_leader',
	'ordersubfields' => 1,
	'cleannsb' => 1,
	'f005_' => 'controlfield_content',
	'f010d' => '45',
	'f099c' => '2011-02-03',
	'f099t' => 'LIVRE',
	'i0991' => '3',
	'i0992' => '4',
	'f200a' => "\x88le \x89titre",
	'f101a' => [ 'lat','fre','spa'],
	'f215a' => [ 'test' ],
	'f700'  => [{'f700f' => '1900-1950','f700a' => 'ICHER','f700b' => [ 'jean','francois']},
		{'f700f' => '1353? - 1435','f700a' => 'PAULUS','f700b' => 'MARIA'}]	};
my $record = MARC::Loader->new($foo);

# Here, the command "print $record->as_formatted;" will return :
# LDR optionnal_leader
# 005     controlfield_content
# 010    _d45
# 099 34 _c2011-02-03
#        _tLIVRE
# 101    _alat
#        _afre
#        _aspa
# 200    _ale titre
# 215    _atest
# 700    _aICHER
#        _bjean
#        _bfrancois
#        _f1900-1950
# 700    _aPAULUS
#        _bMARIA
#        _f1353? - 1435

DESCRIPTION

This is a Perl extension for creating MARC records from a hash variable. MARC::Loader use MARC::Record.

The names of hash keys are very important.

They must begin with one letter ( e.g. f) followed by the 3-digit field ( e.g. 099) optionally followed by the letter or digit of the subfield. Repeatable fields are arrays of hash ( e.g., 'f700' => [{'f700f' => '1900','f700a' => 'ICHER'},{'f700f' => '1353','f700a' => 'PAULUS'}] ). Repeatable subfields are arrays ( e.g., 'f101a' => [ 'lat','fre','spa'] ). Control fields can't be repeatable and are automatically detected when the hash key begin with one letter followed by 3-digit lower than 10 followed by one letter or digit or underscore ( e.g. f005_). Indicators must begin with the letter i followed by the 3-digit field followed by the indicator's position (1 or 2) : e.g. i0991.

Record's leader can be defined with an hash key named 'ldr' ( e.g., 'ldr' => 1 ). You can reorder the fields in alphabetical order with an hash key named 'orderfields' ( e.g., 'orderfields' => 1 ). You can reorder the subfields of each field in alphabetical order with an hash key named 'ordersubfields' ( e.g., 'ordersubfields' => 1 ). You can remove non-sorting characters with an hash key named 'cleannsb' ( e.g., 'cleannsb' => 1 ).

METHOD

new()

  • $record = MARC::Loader->new($foo);

    it's the only function you'll use.

AUTHOR

Stephane Delaune, (delaune.stephane at gmail.com)

COPYRIGHT

Copyright 2011 Stephane Delaune for Biblibre.com, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

1 POD Error

The following errors were encountered while parsing the POD:

Around line 319:

=over without closing =back