#!/usr/bin/perl # require use MARC::Record; use strict; use ZOOM; # define use constant UNDLIBRARIES => 'alephprod.library.nd.edu:9991/ndu01pub'; # get the query my $query = shift; # create an connection and search my $connection = new ZOOM::Connection( UNDLIBRARIES, 0, count => 1, preferredRecordSyntax => "usmarc" ); my $results = $connection->search_pqf( qq["$query"] ); # loop through the results my $hits = $results->size; my $index = 0; my @keywords = split / /, $query; for ( my $i = 0; $i <= $hits - 1; $i++ ) { # get the record my $record = $results->record( $i )->raw; my $marc = MARC::Record->new_from_usmarc( $record ); # extract title and isbn my $title = $marc->title; my $isbn = $marc->field( '020' ); # bold the search terms foreach ( @keywords ) { $title =~ s/($_)/$1<\/b>/i; } # add COinS if ( $isbn ) { $isbn = $isbn->subfield('a'), "\n"; my @isbn = split / /, $isbn; $isbn = $isbn[0]; print '$isbn
'; } else { print ' isbn: ', "\n" } # increment and check $index++; last if $index > 49; }