---
name: "Catmandu::Importer::MAB2"
section: "3pm"
platform: "linux"
package: "libcatmandu-mab2-perl"
version: "0.24-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Importer::MAB2"
---

# Catmandu::Importer::MAB2(3pm)

Package that imports MAB2 data

## NAME

Catmandu::Importer::MAB2 - Package that imports MAB2 data

## SYNOPSIS

```
    use Catmandu::Importer::MAB2;
    my $importer = Catmandu::Importer::MAB2->new(file => "./t/mab2.dat", type=> "raw");
    my $n = $importer->each(sub {
        my $hashref = $_[0];
        # ...
    });
```

To convert between MAB2 syntax variants with the catmandu command line client:

```
    catmandu convert MAB2 --type raw to MAB2 --type xml < mab2.dat
```

## MAB2

The parsed MAB2 record is a HASH containing two keys '\_id' containing the 001 field (or the system identifier of the record) and 'record' containing an ARRAY of ARRAYs for every field:

```
 {
  'record' => [
                [
                    '001',
                    ' ',
                    '_',
                    'fol05882032 '
                ],
                [
                    245,
                    'a',
                    'a',
                    'Cross-platform Perl /',
                    'c',
                    'Eric F. Johnson.'
                ],
        ],
  '_id' => 'fol05882032'
 }
```

## METHODS

This module inherits all methods of Catmandu::Importer and by this Catmandu::Iterable.

## CONFIGURATION

In addition to the configuration provided by Catmandu::Importer (`"file"`, `"fh"`, etc.) the importer can be configured with the following parameters:

- type

  Describes the MAB2 syntax variant. Supported values (case ignored) include the default value `"xml"` for MABxml, `"disk"` for human-readable MAB2 serialization  ("Diskettenformat") or `"raw"` for data-exchange MAB2 serialization ("Bandformat").

## AUTHOR

Johann Rolschewski \<jorol@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Johann Rolschewski.

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