-#!/usr/bin/perl -w
+#!/usr/bin/perl
+
+use warnings;
+use strict;
use Net::Z3950::SimpleServer;
use Net::Z3950::OID;
use COBISS;
-use strict;
my $max_records = 3; # XXX configure this
my $max_result_sets = 10;
my $query;
eval { $query = $rpn->{query}->render(); };
+ warn "ERROR: $@" if $@;
if ( $@ && ref($@) ) { ## Did someone/something report any errors?
$this->{ERR_CODE} = $@->{errcode};
$this->{ERR_STR} = $@->{errstr};
my $setname = $this->{SETNAME};
my $repl_set = $this->{REPL_SET};
+diag "SETNAME $setname REPL_SET $repl_set";
my $result;
unless ( $result = COBISS->search( $query ) ) {
$this->{ERR_CODE} = 108;
}
elsif ( $req_form eq &Net::Z3950::OID::unimarc ) { # FIXME convert to usmarc
$this->{REP_FORM} = &Net::Z3950::OID::unimarc;
- $this->{RECORD} = COBISS->fetch_marc;
+ $this->{RECORD} = COBISS->fetch_rec('unimarc');
+ }
+ elsif ( $req_form eq &Net::Z3950::OID::usmarc ) { # FIXME convert to usmarc
+ $this->{REP_FORM} = &Net::Z3950::OID::usmarc;
+ $this->{RECORD} = COBISS->fetch_rec('usmarc');
}
else { ## Unsupported record format
$this->{ERR_CODE} = 239;
package Net::Z3950::RPN::Term;
+use Data::Dump qw(dump);
use COBISS;
sub render {
- my $this = shift;
+ my ($this,$from) = @_;
+
+print "render ", dump($this);
-print "render ", $this;
+my $usemap = eval '$' . $from . '::usemap';
+die $@ if $@;
+warn "# $from usermap ",dump($usemap);
my $attributes = {};
my $prefix = "";
$attributes->{$type} = $value;
}
if ( defined( my $use = $attributes->{1} ) ) {
- if ( defined( my $field = COBISS::usemap($use) ) ) {
+ if ( defined( my $field = $usemap->{$use} ) ) {
$prefix = $field;
}
else {