example10.pl

#!/usr/bin/perl -w
use Net::Z3950;
$conn = new Net::Z3950::Connection('localhost', 9999)
    or die "can't connect: $!";
$conn->option(querytype => 'ccl2rpn');
$rs = $conn->search('survey and (utah or colorado)')
    or die $conn->errmsg();
print "found ", $rs->size(), " records:\n";
exit if $rs->size() == 0;
$rs->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::USMARC);
my $rec = $rs->record(1)
    or die $rs->errmsg();
my $data = $rec->rawdata();

use MARC;
my $inc = MARC::Rec->new();
my($mrec, $status) = $inc->nextrec($data);
die "can't translate MARC record" if !$status;
print $mrec->output({ format => 'ascii' });
  

As example 8, but fetches record in USMARC format.
Retrieves raw MARC data rather than the ``human-readable'' format.
[output]

[prev] [next]