The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MARC::Moose::Formater::UnimarcToMarc21 - Convert biblio record from UNIMARC to MARC21

VERSION

version 1.0.49

SYNOPSYS

Read a UNIMARC ISO2709 file and dump it to STDOUT in text transformed into MARC21:

my $reader = MARC::Moose::Reader::File::Iso2709->new(
  file => 'biblio-unimarc.iso' );
my $formater = MARC::Moose::Formater::UnimarcToMarc21->new();
while ( my $unimarc = $reader->read() ) {
  my $marc21 = $formater->format($unimarc);
  print $marc21->as('Text');
}

Same with shortcut:

my $reader = MARC::Moose::Reader::File::Iso2709->new(
  file => 'biblio-unimarc.iso' );
while ( my $unimarc = $reader->read() ) {
  print $unimarc->as('UnimarcToMarc21')->as('Text');
}

Read a UNIMARC ISO2709 file and dump it to another ISO2709 file transformed into MARC21:

my $reader = MARC::Moose::Reader::File::Iso2709->new(
  file => 'biblio-unimarc.iso' );
my $writer = MARC::Moose::Writer->new(
  fh => IO::File->new('koha.mrc', '>:encoding(utf8)'),
  formater => MARC::Moose::Formater::Iso2709->new() )
);
my $tomarc21 = MARC::Moose::Formater::UnimarcToMarc21->new();
while ( my $unimarc = $reader->read() ) {
  $writer->write( $tomarc21->format($unimarc) );
}

COMMAND LINE

If you don't want to write a Perl script, you can use the marcmoose command. This way, you can for example convert a ISO 2709 UNIMARC file named unimarc.iso into a ISO 2709 MARC21 file named marc.iso:

marcmoose --parser iso2709 --formater iso2709 --converter unimarctomarc21
          --output marc.iso unimarc.iso

AUTHOR

Frédéric Demians <f.demians@tamil.fr>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Frédéric Demians.

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