Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michal-josef-spacek/mets-files
Get page files from METS specification
https://github.com/michal-josef-spacek/mets-files
mets perl
Last synced: 25 days ago
JSON representation
Get page files from METS specification
- Host: GitHub
- URL: https://github.com/michal-josef-spacek/mets-files
- Owner: michal-josef-spacek
- License: bsd-2-clause
- Created: 2020-02-13T19:57:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-01T17:01:11.000Z (about 1 year ago)
- Last Synced: 2024-05-02T01:28:32.162Z (9 months ago)
- Topics: mets, perl
- Language: Perl
- Size: 73.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
NAME
METS::Files - Class for METS files manipulation.SYNOPSIS
use METS::Files;my $obj = METS::Files->new(
'mets_data' => $mets_data,
);
my @files = $obj->get_use_files($use);
my @types = $obj->get_use_types;METHODS
"new"
my $obj = METS::Files->new(
'mets_data' => $mets_data,
);Constructor.
* "mets_data"
METS data.
Parameter is required.
Returns instance of object.
"get_use_files"
my @files = $obj->get_use_files($use);Get "USE" files defined by $use variable.
Returns array with files.
"get_use_types"
my @types = $obj->get_use_types;Get "USE" types.
Returns array with types.
ERRORS
new():
Parameter 'mets_data' is required.
From Class::Utils::set_params():
Unknown parameter '%s'.EXAMPLE1
use strict;
use warnings;use Data::Printer;
use METS::Files;
use Perl6::Slurp qw(slurp);# Arguments.
if (@ARGV < 1) {
print STDERR "Usage: $0 mets_file\n";
exit 1;
}
my $mets_file = $ARGV[0];# Get mets data.
my $mets_data = slurp($mets_file);# Object.
my $obj = METS::Files->new(
'mets_data' => $mets_data,
);# Get files.
my $files_hr;
foreach my $use ($obj->get_use_types) {
$files_hr->{$use} = [$obj->get_use_files($use)];
}# Dump to output.
p $files_hr;# Output without arguments like:
# Usage: __SCRIPT__ mets_fileEXAMPLE2
use strict;
use warnings;use Data::Printer;
use METS::Files;# Example METS data.
my $mets_data = <<'END';
END# Object.
my $obj = METS::Files->new(
'mets_data' => $mets_data,
);# Get files.
my $files_hr;
foreach my $use ($obj->get_use_types) {
$files_hr->{$use} = [$obj->get_use_files($use)];
}# Dump to output.
p $files_hr;# Output:
# \ {
# Images [
# [0] "file://./003855/003855r.tif",
# [1] "file://./003855/003855v.tif"
# ],
# PDF [
# [0] "file://./003855/003855r.pdf",
# [1] "file://./003855/003855v.pdf"
# ]
# }DEPENDENCIES
Class::Utils, Error::Pure, METS::Parse::Simple, Readonly.REPOSITORY
AUTHOR
Michal Josef Špaček
LICENSE AND COPYRIGHT
© 2015-2024 Michal Josef ŠpačekBSD 2-Clause License
VERSION
0.04