From: Mike Taylor Date: Tue, 6 Apr 2010 14:45:07 +0000 (+0100) Subject: New file irspy-dump.pl ... no idea what happened to the old one. X-Git-Tag: CPAN-v1.02~54^2~124 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=86fdafcf702cd844e9c3a285ad03ac31ec6b28d7;p=irspy-moved-to-github.git New file irspy-dump.pl ... no idea what happened to the old one. --- diff --git a/bin/irspy-dump.pl b/bin/irspy-dump.pl new file mode 100755 index 0000000..36cf3e4 --- /dev/null +++ b/bin/irspy-dump.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; +use ZOOM; + +if (@ARGV != 1) { + print STDERR "Usage: $0 target\n"; + exit 1; +} + +my $conn = new ZOOM::Connection($ARGV[0]); +$conn->option(preferredRecordSyntax => "xml"); +$conn->option(elementSetName => "zebra::data"); +my $rs = $conn->search_pqf('@attr 1=_ALLRECORDS @attr 2=103 ""'); +my $n = $rs->size(); +$| = 1; +print "$0: dumping $n records\n"; +foreach my $i (1..$n) { + print "."; + print " $i/$n (", int($i*100/$n), "%)\n" if $i % 50 == 0; + my $rec = $rs->record($i-1); + my $xml = $rec->render(); + open F, ">$i.xml"; + print F $xml; + close F; +} +print " $n/$n (100%)\n" if $n % 50 != 0; +print "complete\n";