NAME
Archive::BagIt::Base
VERSION
version 0.059
SYNOPSIS
This modules will hopefully help with the basic commands needed to create and verify a bag. This part supports BagIt 1.0 according to RFC 8493 ([https://tools.ietf.org/html/rfc8493](https://tools.ietf.org/html/rfc8493)).
use Archive::BagIt::Base;
#read in an existing bag:
my $bag_dir = "/path/to/bag";
my $bag = Archive::BagIt::Base->new($bag_dir);
#construct bag in an existing directory
my $bag2 = Archive::BagIt::Base->make_bag($bag_dir);
# Validate a BagIt archive against its manifest
my $bag3 = Archive::BagIt::Base->new($bag_dir);
my $is_valid1 = $bag3->verify_bag();
# Validate a BagIt archive against its manifest, report all errors
my $bag4 = Archive::BagIt::Base->new($bag_dir);
my $is_valid2 = $bag4->verify_bag( {report_all_errors => 1} );
NAME
Archive::BagIt::Base
VERSION
version 0.059
NAME
Achive::BagIt::Base - The common base for both Bagit and dotBagIt
AUTHORS
- Robert Schmidt, <rjeschmi at gmail.com>
- William Wueppelmann, <william at c7a.ca>
- Andreas Romeyke, <pause at andreas minus romeyke.de>
CONTRIBUTORS
SOURCE
The original development version was on github at http://github.com/rjeschmi/Archive-BagIt and may be cloned from there.
The actual development version is available at https://art1pirat.spdns.org/art1/Archive-BagIt
Conformance to RFC8493
The module should fulfill the RFC requirements, with following limitations:
- only encoding UTF-8 is supported
- version 0.97 or 1.0 allowed
- version 0.97 requires tag-/manifest-files with md5-fixity
- version 1.0 requires tag-/manifest-files with sha512-fixity
- BOM is not supported
- Carriage Return in bagit-files are not allowed
- fetch.txt is unsupported
At the moment only filepaths in linux-style are supported.
To get an more detailled overview, see the testsuite under t/verify_bag.t and corresponding test bags from the BagIt conformance testsuite of Library of Congress under bagit_conformance_suite/.
See https://datatracker.ietf.org/doc/rfc8493/?include_text=1 for details.
TODO
- Add support for non-Unix based filesystems
- enhanced testsuite
- improved plugin mechanism
- reduce complexity
- use modern perl code
- add code to easily update outdated Bags to v1.0
- add more ecamples in documentation
Constructor
The constructor sub, will create a bag with a single argument,
use Archive::BagIt::Base;
#read in an existing bag:
my $bag_dir = "/path/to/bag";
my $bag = Archive::BagIt::Base->new($bag_dir);
or use hashreferences
use Archive::BagIt::Base;
#read in an existing bag:
my $bag_dir = "/path/to/bag";
my $bag = Archive::BagIt::Base->new(
bag_path => $bag_dir,
parallel => 1
);
The arguments are:
bag_path
- path to bag-directoryparallel
- if set and Parallel::Iterator available, it verifies files in parallel. Hint: use it only for very large bagits, because overhead for parallelization
load_plugins
As default SHA512 and MD5 will be loaded and therefore used. If you want to create a bag only with one or a specific checksum-algorithm, you could use this method to (re-)register it. It expects list of strings with namespace of type: Archive::BagIt::Plugin::Algorithm::XXX where XXX is your chosen fixity algorithm.
verify_bag
An interface to verify a bag.
You might also want to check Archive::BagIt::Fast to see a more direct way of accessing files (and thus faster).
calc_payload_oxum()
returns an array with octets and streamcount of payload-dir
calc_bagsize()
returns a string with human readable size of paylod
store
store a bagit-obj if bagit directory-structure was already constructed,
init_metadata
A constructor that will just create the metadata directory
This won't make a bag, but it will create the conditions to do that eventually
make_bag
A constructor that will make and return a bag from a directory,
It expects a preliminary bagit-dir exists. If there a data directory exists, assume it is already a bag (no checking for invalid files in root)
AVAILABILITY
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see https://metacpan.org/module/Archive::BagIt/.
SOURCE
The development version is on github at https://github.com/Archive-BagIt and may be cloned from git://github.com/Archive-BagIt.git
BUGS AND LIMITATIONS
You can make new bug reports, and view existing ones, through the web interface at http://rt.cpan.org.
AUTHOR
Rob Schmidt <rjeschmi@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by Rob Schmidt and William Wueppelmann.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
AUTHOR
Rob Schmidt <rjeschmi@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by Rob Schmidt and William Wueppelmann.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.