| 1 | #!/usr/local/bin/perl -w | ||
| 2 | |||
| 3 | # $Id: alvis-pipeline-put-documents.pl,v 1.1 2006/07/11 10:36:37 mike Exp $ | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | use IO::File; | ||
| 8 | use Alvis::Pipeline; | ||
| 9 | |||
| 10 | die "Usage: $0 <host> <port> <file> ..." if @ARGV < 3; | ||
| 11 | my $host = shift(); | ||
| 12 | my $port = shift(); | ||
| 13 | my $loglevel = 3; ### should be settable from command-line | ||
| 14 | |||
| 15 | my $pipe = new Alvis::Pipeline::Write(host => $host, port => $port, | ||
| 16 | loglevel => $loglevel) | ||
| 17 | or die "can't create write-pipe for host '$host', port '$port': $!"; | ||
| 18 | |||
| 19 | foreach my $filename (@ARGV) { | ||
| 20 | my $fh = new IO::File("<$filename") | ||
| 21 | or die "can't open '$filename' for reading: $!"; | ||
| 22 | my $xml = join("", <$fh>); | ||
| 23 | $fh->close(); | ||
| 24 | $pipe->write($xml); | ||
| 25 | } | ||
| 26 | |||
| 27 | $pipe->close(); | ||
| 28 | # Ha! That was easy :-) |