From 3c02257514b1f105c8a3b3aec9b7e0dfdd932f96 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 14 Oct 2013 00:08:55 +0200 Subject: [PATCH 1/1] document all options, fix offset and limit --- META.yml | 13 ------------- scripts/dump_fastmarc.pl | 13 ++++++++----- 2 files changed, 8 insertions(+), 18 deletions(-) delete mode 100644 META.yml diff --git a/META.yml b/META.yml deleted file mode 100644 index 1e9c3a0..0000000 --- a/META.yml +++ /dev/null @@ -1,13 +0,0 @@ -# http://module-build.sourceforge.net/META-spec.html -#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# -name: MARC-Fast -version: 0.03 -version_from: Fast.pm -installdirs: site -requires: - Carp: 0 - Test::Exception: 0 - Test::Simple: 0.44 - -distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.17 diff --git a/scripts/dump_fastmarc.pl b/scripts/dump_fastmarc.pl index dd4897c..a940007 100755 --- a/scripts/dump_fastmarc.pl +++ b/scripts/dump_fastmarc.pl @@ -27,6 +27,10 @@ dump records starting with C dump just C records +=item -n mfn + +dump single C record (same as C<-o mfn -l 1>) + =item -h dump result of C on record @@ -44,17 +48,16 @@ dump tsv file for TokyoCabinet import =cut my %opt; -getopts('do:l:ht', \%opt); +getopts('do:l:n:ht', \%opt); -my $file = shift @ARGV || die "usage: $0 [-o offset] [-l limit] [-h] [-d] file.marc\n"; +my $file = shift @ARGV || die "usage: $0 [-o offset] [-l limit] [-n single_mfn] [-h] [-d] [-t] file.marc\n"; my $marc = new MARC::Fast( marcdb => $file, debug => $opt{d}, ); - -my $min = 1; +my $min = $opt{o} || 1; my $max = $marc->count; if (my $mfn = $opt{n}) { @@ -62,7 +65,7 @@ if (my $mfn = $opt{n}) { print STDERR "Dumping $mfn only\n"; } elsif (my $limit = $opt{l}) { print STDERR "$file has $max records, using first $limit\n"; - $max = $limit; + $max = $min + $limit - 1; } else { print STDERR "$file has $max records...\n"; } -- 2.20.1