NAME

Catmandu::Importer::MODS - Catmandu Importer for importing mods records

SYNOPSIS

use Catmandu::Importer::MODS;

my $importer = Catmandu::Importer::MODS->new(file => "modsCollection.xml",type => "xml");  

my $numModsElements = $importer->each(sub{
  #$modsElement is a MODS::Element::Mods object
  my $modsElement = shift;    
});

DESCRIPTION

MODS can be expressed in either XML or JSON. XML is the more common way to express. This module reads from a file, and iterates over the elements 'mods'. In case of a simple mods document, only one element is found. In case of a 'modsCollection', several mods elements can be found.

These files SHOULD be expressed in UTF-8.

METHODS

Catmandu::Importer::MODS->new(file => "mods.xml",type => "xml")

Creates a new importer. 'file' can anything that can be transformed into an IO::Handle by Catmandu::Util::io. See http://search.cpan.org/~nics/Catmandu-0.5004/lib/Catmandu/Util.pm for more information.

'type' can only be 'json' or 'xml'.

each(sub{ .. })

The importer transforms the input 'file' into an array of MODS::Element::Mods. This method iterates over that list, and supplies the callback with one MODS::Element::Mods at a time.

SEE ALSO

  • MODS::Record

  • Library Of Congress MODS pages (http://www.loc.gov/standards/mods/)

DESIGN NOTES

  • This module is part of the LibreCat/Catmandu project http://librecat.org

  • Make sure your files are expressed in UTF-8.

AUTHORS

  • Nicolas Franck <Nicolas . Franck at UGent . be>

LICENSE

This library is free software and may be distributed under the same terms as perl itself. See http://dev.perl.org/licenses/.