The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catmandu::Exporter::BagIt - Package that exports data as BagIts

SYNOPSIS

   use Catmandu::Exporter::BagIt;

   my $exporter = Catmandu::Exporter::BagIt->new(
                            overwrite     => 0 ,
                            skip_manifest => 0,
                  );

   $exporter->add($bagit_record);

   $exporter->commit;

BagIt

The parsed BagIt record is a HASH containing the key '_id' containing the BagIt directory name and one or more fields:

    {
          '_id' => 'bags/demo01',
          'version' => '0.97',                          # Not required, all bags will be 0.97
          'tags' => {
                      'Bagging-Date' => '2014-10-03',   # Not required, generated ...
                      'Bag-Software-Agent' => 'FooBar', # Not required, generated ...
                      'DC-Title'   => 'My downloads' ,
                      'DC-Creator' => 'Bunny, Bugs' ,
                    },
           },
           'fetch' => [
               { 'http://server/download1.pdf'  => 'data/my_download1.pdf' } ,
               { 'http://server2/download2.pdf' => 'data/my_download2.pdf' } ,
           ],
    };

All URL's in the fetch array will be mirrored and added to the bag. All payload files should be put in the 'data' subdirectory as shown in the example above.

You can also add files from disk, using the "files" array:

    {
          '_id' => 'bags/demo01',
           'files' => [
               { '/tmp/download1.pdf'  => 'data/my_download1.pdf' } ,
               { '/tmp/download2.pdf' => 'data/my_download2.pdf' } ,
           ],
    };

METHODS

This module inherits all methods of Catmandu::Exporter.

CONFIGURATION

In addition to the configuration provided by Catmandu::Exporter the exporter can be configured with the following parameters:

ignore_existing

Optional. Skip an item when the BagIt for it already exists.

overwrite

Optional. Throws an Catmandu::Error when the exporter tries to overwrite an existing directory.

skip_manifest

Optional. Skips the re-calculation of MD5 manifest checksums in case BagIt directories get overwritten. Use this option for instance when overwriting only the tags of a bag.

SEE ALSO

Catmandu, Catmandu::Exporter, Archive::BagIt

AUTHOR

Patrick Hochstenbach <Patrick.Hochstenbach@UGent.be>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Patrick Hochstenbach.

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