/[Z3950-HTML-Scraper]/server.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /server.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by dpavlin, Sat Jun 20 19:42:32 2009 UTC revision 13 by dpavlin, Fri Oct 22 21:12:46 2010 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl
2    
3    use warnings;
4    use strict;
5    
6  use Net::Z3950::SimpleServer;  use Net::Z3950::SimpleServer;
7  use Net::Z3950::OID;  use Net::Z3950::OID;
8  use COBISS;  use COBISS;
 use strict;  
9    
10  my $max_records = 3; # XXX configure this  my $max_records = 3; # XXX configure this
11  my $max_result_sets = 10;  my $max_result_sets = 10;
# Line 44  diag "search for $query"; Line 46  diag "search for $query";
46    
47      my $setname  = $this->{SETNAME};      my $setname  = $this->{SETNAME};
48      my $repl_set = $this->{REPL_SET};      my $repl_set = $this->{REPL_SET};
49    diag "SETNAME $setname REPL_SET $repl_set";
50      my $result;      my $result;
51      unless ( $result = COBISS->search( $query ) ) {      unless ( $result = COBISS->search( $query ) ) {
52          $this->{ERR_CODE} = 108;          $this->{ERR_CODE} = 108;
53          return;          return;
54      }      }
55      my $hits = $CROBISS::hits || diag "no results for $query";      my $hits = $COBISS::hits || diag "no results for $query";
56    diag "got $hits hits";
57      my $rs   = {      my $rs   = {
58          lower => 1,          lower => 1,
59          upper => $hits < $max_records ? $max_records : $hits,          upper => $hits < $max_records ? $max_records : $hits,
# Line 102  diag Dumper( $this ); Line 106  diag Dumper( $this );
106      }      }
107      elsif ( $req_form eq &Net::Z3950::OID::unimarc ) {  # FIXME convert to usmarc      elsif ( $req_form eq &Net::Z3950::OID::unimarc ) {  # FIXME convert to usmarc
108          $this->{REP_FORM} = &Net::Z3950::OID::unimarc;          $this->{REP_FORM} = &Net::Z3950::OID::unimarc;
109          $this->{RECORD} = COBISS->fetch_marc;          $this->{RECORD} = COBISS->fetch_rec('unimarc');
110        }
111        elsif ( $req_form eq &Net::Z3950::OID::usmarc ) {   # FIXME convert to usmarc
112            $this->{REP_FORM} = &Net::Z3950::OID::usmarc;
113            $this->{RECORD} = COBISS->fetch_rec('usmarc');
114      }      }
115      else {    ## Unsupported record format      else {    ## Unsupported record format
116          $this->{ERR_CODE} = 239;          $this->{ERR_CODE} = 239;
# Line 152  sub render { Line 160  sub render {
160    
161  package Net::Z3950::RPN::Term;  package Net::Z3950::RPN::Term;
162    
163    use Data::Dump qw(dump);
164  use COBISS;  use COBISS;
165    
166  sub render {  sub render {
167      my $this       = shift;      my $this       = shift;
168    
169  print "render ", $this;  print "render ", dump($this);
170    
171      my $attributes = {};      my $attributes = {};
172      my $prefix     = "";      my $prefix     = "";

Legend:
Removed from v.6  
changed lines
  Added in v.13

  ViewVC Help
Powered by ViewVC 1.1.26