[Koha-cvs] koha/z3950 search.pl [rel_2_2]

Ryan Higgins rch at liblime.com
Thu Apr 12 21:27:30 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Ryan Higgins <rych>	07/04/12 19:27:30

Modified files:
	z3950          : search.pl 

Log message:
	adding eval so MARC::Record does not die on bad record from ZOOM

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/z3950/search.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.3.2.22&r2=1.3.2.23

Patches:
Index: search.pl
===================================================================
RCS file: /sources/koha/koha/z3950/Attic/search.pl,v
retrieving revision 1.3.2.22
retrieving revision 1.3.2.23
diff -u -b -r1.3.2.22 -r1.3.2.23
--- search.pl	29 Mar 2007 23:05:26 -0000	1.3.2.22
+++ search.pl	12 Apr 2007 19:27:30 -0000	1.3.2.23
@@ -85,13 +85,14 @@
         );
 
 if ($op ne "do_search"){
-    my $sth=$dbh->prepare("select id,host,checked from z3950servers  order by host");
+    my $sth=$dbh->prepare("select id,host,checked,name from z3950servers  order by host");
     $sth->execute();
     while ($server=$sth->fetchrow_hashref) {
         my %temploop;
         $temploop{server}=$server->{host};
         $temploop{id}=$server->{id};
         $temploop{checked}=$server->{checked};
+        $temploop{name}=$server->{name};
         push (@serverloop, \%temploop);
     }
     $template->param(isbn=>$isbn, issn=>$issn,title=>$title,author=>$author,
@@ -174,7 +175,14 @@
             for ($i=0; $i<(($numresults<5) ? ($numresults) : (5)) ; $i++) {
                 my $rec=$oResult[$k]->record($i);
                 my $marcrecord;
+                eval {
                 $marcdata = $rec->raw();
+                };
+				if ($@) { 
+					warn "MARC::Record chokes on MARC from ZOOM.";
+					warn $@;
+					next;
+				}
                 $marcrecord = MARC::File::USMARC::decode($marcdata);
 ####WARNING records coming from Z3950 clients are in various character sets MARC8,UTF8,UNIMARC etc
 ## In HEAD i change everything to UTF-8





More information about the Koha-cvs mailing list