Alvis-Pipeline
view release on metacpan or search on metacpan
bin/alvis-zsink.pl view on Meta::CPAN
# alvis-zsink.pl 8021 localhost:1314
use strict;
use warnings;
use Alvis::Pipeline 0.07;
use Net::Z3950::ZOOM 1.11; # We don't use this, but it's ZOOM's release
use ZOOM;
if (@ARGV != 2 && @ARGV != 4) {
print STDERR <<__EOT__;
Usage: $0 <listen-port> <z-host> [<user> <password>]
<listen-port> is the port on which to listen for documents being
fed down the Alvis pipeline; <z-host> is ZOOM-style Z39.50 host
string such as 'localhost:1314' or 'tcp:alvis.indexdata.com:8122'
__EOT__
exit 1;
}
my($port, $zhost, $user, $password) = @ARGV;
my $pipe = new Alvis::Pipeline::Read(port => $port,
spooldir => "/tmp/alvis-spool")
or die "can't create read-pipe on port $port: $!";
$pipe->option(sleep => 1);
print "Listening on pipeline\n";
my $options = new ZOOM::Options();
$options->option(user => $user) if defined $user;
$options->option(password => $password) if defined $password;
my $conn = create ZOOM::Connection($options);
my $connected = 0;
my $n = 0;
$| = 1;
while (my $xml = $pipe->read(1)) {
eval {
$conn->connect($zhost);
}; if ($@ && ref $@ && $@->isa("ZOOM::Exception") &&
$@->diagset() eq "Bib-1" && $@->code() == 224) {
( run in 0.530 second using v1.01-cache-2.11-cpan-49f99fa48dc )