#!/usr/bin/perl # opac.pl - a simple z39.50 client # Eric Lease Morgan # 2007-06-05 - based on previous work with ZOOM Perl # require use MARC::Record; use strict; use ZOOM; # define use constant DATABASE => 'wilson.infomotions.com:9999/ii'; # test server # get the query my $query = shift; # sanity check if ( ! $query ) { print "Usage: $0 query\n"; exit; } # create an connection and search my $connection = new ZOOM::Connection( DATABASE, 0, count => 1, preferredRecordSyntax => "usmarc" ); my $results = $connection->search_pqf( qq[$query] ); # loop through the first 50 hits results my $index = 0; for ( my $i = 0; $i <= 49; $i++ ) { # get the record my $record = $results->record( $i )->raw; my $marc = MARC::Record->new_from_usmarc( $record ); # extract some data my $author = $marc->author; my $title = $marc->title_proper; my $date = $marc->publication_date; # display print " author: $author\n"; print " title: $title\n"; print " date: $date\n"; print "\n"; }