Catmandu
view release on metacpan or search on metacpan
lib/Catmandu.pm view on Meta::CPAN
my $name = shift;
my $package = shift;
my $options = ref $_[0] ? $_[0] : {@_};
$class->config->{exporter}{$name}
= {package => $package, options => $options};
}
sub define_store {
my $class = shift;
my $name = shift;
my $package = shift;
my $options = ref $_[0] ? $_[0] : {@_};
$class->config->{store}{$name}
= {package => $package, options => $options};
}
sub define_fixer {
my $class = shift;
my $name = shift;
my $fixes = ref $_[0] ? $_[0] : [@_];
$class->config->{fixer}{$name} = $fixes;
}
1;
__END__
=pod
=encoding utf-8
=head1 NAME
Catmandu - a data toolkit
=head1 SYNOPSIS
# From the command line
# Convert data from one format to another
$ catmandu convert JSON to CSV < data.json
$ catmandu convert CSV to YAML < data.csv
$ catmandu convert MARC to YAML < data.mrc
# Fix data, add, delete, change fields
$ catmandu convert JSON --fix 'move_field(title,my_title)' < data.json
$ catmandu convert JSON --fix all_my_fixes.txt < data.json
# Use a moustache preprocessor on the fix script
$ catmandu convert JSON --fix all_my_fixes.txt --var opt1=foo --var opt2=bar < data.json
# run a fix script
$ catmandu run myfixes.fix
# or, create an executable fix script
$ cat myfixes.fix
#!/usr/local/bin/catmandu run
do importer(OAI,url:"http://biblio.ugent.be/oai")
retain(_id)
end
$ chmod 755 myfixes.fix
$ ./myfixes.fix
=head1 DESCRIPTION
Catmandu provides a command line tools for the conversion of various data
formats including: JSON, YAML, RDF, CSV, TSV, XML and even Excel. Using
extension modules, specialized conversions for metadata formats using
in libraries, archives and museums is also supports. We provide support
for MARC, MAB, MODS, OAI-PMH, PICA, PNX, RIS, LIDO, SRU and Z39.50.
Specialized conversions require a mapping language. This is implemented in
Catmandu using the `Fix` language. For a short introduction read
L<Catmandu::Introduction>. Online tutorials can be found at the end of this document.
=head1 INSTALL
=head2 From Source
# Clone the directory
git clone https://github.com/LibreCat/Catmandu
# Build
cd Catmandu
cpanm -n -q --installdeps --skip-satisfied .
perl Build.PL && ./Build && ./Build install
=head2 Using Docker
docker build -t librecat/catmandu .
# Run catmandu with access to you local files at <YourDrive>
docker run -v <YourDrive>:/home/catmandu/Home -it librecat/catmandu
# E.g.
docker run -v C:\Users\alice:/home/catmandu/Home -it librecat/catmandu
=head1 INSTALL EXTENSIONS
cpanm install <PackageName>
# E.g.
cpanm install Catmandu::MARC
=head1 POPULAR EXTENSIONS
L<Catmandu::Breaker>
L<Catmandu::Identifier>
L<Catmandu::MARC>
L<Catmandu::OAI>
L<Catmandu::PICA>
L<Catmandu::RDF>
L<Catmandu::SRU>
L<Catmandu::Stat>
( run in 0.573 second using v1.01-cache-2.11-cpan-f56aa216473 )