From a99a7403b08bee36fad125cf50f4f0f5c3de99a2 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 9 Jun 2008 13:49:32 +0000 Subject: [PATCH] record_get() hackery for OPAC/XML records now works for complex $type. --- lib/Net/Z3950/ZOOM.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Net/Z3950/ZOOM.pm b/lib/Net/Z3950/ZOOM.pm index b8e3fda..ed8d02f 100644 --- a/lib/Net/Z3950/ZOOM.pm +++ b/lib/Net/Z3950/ZOOM.pm @@ -1,4 +1,4 @@ -# $Id: ZOOM.pm,v 1.37 2008-05-14 13:29:57 mike Exp $ +# $Id: ZOOM.pm,v 1.38 2008-06-09 13:49:32 mike Exp $ package Net::Z3950::ZOOM; @@ -153,12 +153,20 @@ sub event_str { sub record_get { my($rec, $type) = @_; + my $simpletype = $type; + $simpletype =~ s/;.*//; + warn "record_get('$rec', '$simpletype' -> '$type')\n"; if (grep { $type eq $_ } qw(database syntax schema)) { return record_get_string($rec, $type); } else { my $val = record_get_binary($rec, $type); - if ($type eq "opac" && !defined $val) { - $val = record_get_binary($rec, "xml"); + if ($simpletype eq "opac" && !defined $val) { + my $newtype = $type; + if ($newtype !~ s/.*?;/xml;/) { + $newtype = "xml"; + } + warn "fallback('$rec', '$newtype')\n"; + $val = record_get_binary($rec, $newtype); } return $val; } -- 1.7.10.4