35 |
|
|
36 |
turn debugging output on |
turn debugging output on |
37 |
|
|
38 |
|
=item -t |
39 |
|
|
40 |
|
dump tsv file for TokyoCabinet import |
41 |
|
|
42 |
=back |
=back |
43 |
|
|
44 |
=cut |
=cut |
45 |
|
|
46 |
my %opt; |
my %opt; |
47 |
getopts('do:l:h', \%opt); |
getopts('do:l:ht', \%opt); |
48 |
|
|
49 |
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] [-h] [-d] file.marc\n"; |
50 |
|
|
69 |
|
|
70 |
for my $mfn ($min .. $max) { |
for my $mfn ($min .. $max) { |
71 |
my $rec = $marc->fetch($mfn) || next; |
my $rec = $marc->fetch($mfn) || next; |
72 |
print "rec is ",dump($rec) if ($opt{d}); |
warn "rec is ",dump($rec) if ($opt{d}); |
73 |
print "REC $mfn\n"; |
if ( $opt{t} ) { |
74 |
print $marc->last_leader,"\n"; |
print "rec\t$mfn\tleader\t", $marc->last_leader, "\t"; |
75 |
print $marc->to_ascii($mfn),"\n"; |
my $ascii = $marc->to_ascii($mfn); |
76 |
print "hash is ",dump($marc->to_hash($mfn, include_subfields => 1)) if ($opt{h}); |
$ascii =~ s{\n}{\t}gs; |
77 |
|
print "$ascii\n"; |
78 |
|
} else { |
79 |
|
print "REC $mfn\n"; |
80 |
|
print $marc->last_leader,"\n"; |
81 |
|
print $marc->to_ascii($mfn),"\n"; |
82 |
|
} |
83 |
|
warn "hash is ",dump($marc->to_hash($mfn, include_subfields => 1)) if ($opt{h}); |
84 |
} |
} |