| 1 | #!/usr/local/bin/perl -w | ||
| 2 | |||
| 3 | # $Id: alvis-pipeline-get.pl,v 1.4 2005/09/30 16:20:28 mike Exp $ | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | use Alvis::Pipeline; | ||
| 8 | |||
| 9 | die "Usage: $0 <port> <spooldir>" if @ARGV != 2; | ||
| 10 | my($port, $spooldir) = @ARGV; | ||
| 11 | my $pipe = new Alvis::Pipeline::Read(port => $port, spooldir => $spooldir) | ||
| 12 | or die "can't create read-pipe on port $port: $!"; | ||
| 13 | |||
| 14 | my $n = 0; | ||
| 15 | while (my $xml = $pipe->read(1)) { | ||
| 16 | $xml .= "\n" if $xml !~ /\n$/; | ||
| 17 | print "=== new document ===\n$xml"; | ||
| 18 | $n++; | ||
| 19 | } | ||
| 20 | |||
| 21 | $pipe->close(); | ||
| 22 | print "No documents in pipeline\n" | ||
| 23 | if $n == 0; |