#!/usr/bin/perl package main; # PODNAME: marcmoose-lint # ABSTRACT: Lint ISO2709 file against validation rules $main::VERSION = '1.0.17'; use Modern::Perl; use Pod::Usage; use Getopt::Long; use MARC::Moose::Lint::Checker::RulesFile; use MARC::Moose::Lint::Processor; my ($verbose, $help) = (1, 0); GetOptions( 'verbose!' => \$verbose, 'help' => \$help, ); usage() if @ARGV != 2 || $help; my ($rule, $file) = @ARGV; unless (-f $file) { say "File doesn't exist: $file"; exit; } my $processor = MARC::Moose::Lint::Processor->new( lint => MARC::Moose::Lint::Checker::RulesFile->new( file => $rule ), file => $file, verbose => $verbose, ); $processor->run(); sub usage { pod2usage( -verbose => 2 ); } __END__ =pod =encoding UTF-8 =head1 NAME marcmoose-lint - Lint ISO2709 file against validation rules =head1 VERSION version 1.0.17 =head1 DESCRIPTION Command line utility to I<lint> biblio records based on a validation rules file. Biblio records file must be in ISO2709 format (UTF-8 only). Validation rules file is in the format described in L<MARC::Moose::Lint::Checker>. At the end of the process, handled by L<MARC::Moose::Lint::Processor>, 3 files are generated: F<marc.iso.ok>, an ISO2709 file containing biblio records complying with validation rules, F<marc.iso.bad>, an ISO2709 file which contains records violating validation rules, and F<marc.iso.log> a text file containing a text version of the biblio records that have failed the validation, followed by a description of the violated rules. B<TIP:> You can get quick statistics on errors frequency with this Perl On-Liner: perl -ne 'if (/^([0-9]{3})[()0-9]*: *(.*)$/) { print "$1: $2\n";}' marc.iso.log | sort | uniq -c =head1 SYNOPSYS marcmoose-lint --help marcmoose-lint unimarc.rules marc.iso marcmoose-lint --noverbose marc21.rules marc.iso =head1 SEE ALSO =over 4 =item * L<MARC::Moose> =item * L<MARC::Moose::Lint::Checker> =item * L<MARC::Moose::Lint::Processor> =back =head1 AUTHOR Frédéric Demians <f.demians@tamil.fr> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Frédéric Demians. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut