-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogging-server.pl
More file actions
executable file
·43 lines (36 loc) · 1.08 KB
/
logging-server.pl
File metadata and controls
executable file
·43 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl -w
# This is just about the simplest possible SimpleServer-based Z39.50
# server. It exists only to log the data-structures that are handed
# to the back-end functions, and does only enough work otherwise to
# hand the client a coherent (if useless) response to its requests.
use strict;
use warnings;
use Net::Z3950::SimpleServer;
use Data::Dumper;
my $handler = new Net::Z3950::SimpleServer(INIT => \&init_handler,
CLOSE => \&close_handler,
SEARCH => \&search_handler,
FETCH => \&fetch_handler);
$handler->launch_server("logging-server.pl", @ARGV);
sub init_handler {
my $href = shift;
print "INIT: ", Dumper($href);
}
sub search_handler {
my $href = shift;
print "Search: ", Dumper($href);
$href->{HITS} = 1;
}
sub fetch_handler {
my $href = shift;
print "Fetch: ", Dumper($href);
my $record = "<dummy>foo</dummy>";
$href->{RECORD} = $record;
$href->{LEN} = length($record);
$href->{NUMBER} = 1;
$href->{BASENAME} = "Test";
}
sub close_handler {
my $href = shift;
print "Close: ", Dumper($href);
}