diomedea has asked for the wisdom of the Perl Monks concerning the following question:
I can get the writer to print the line to stdout but sqlloader just hangs. im not wedded to this approach if it looks like a bad thing to do, but i have to parse 1000 files and read them in, so id rather do it in memory. thanksif ($pid = open ($fifo, "|-")) # cookbok 16.11 open for r and w to ava +oid blocks { $fifo->autoflush(1); no warnings; foreach my $ky (sort keys %categories) { print $fifo "$categories{$ky}#"; } close $fifo or die $! ? "Syserr closing fifo writer: $!" : "Wait status $? from fifo writer"; } else # child { die "Cannot fork: $!" unless defined $pid; # copy from parent (now stdin) into the file # need to redirect st +din? #$fifofile->autoflush(1); while (<STDIN>) { $fifofile = $_; # print $fifofile; system "sqlldr control=atpctl.ctl data=atp_fifo.dat userid=someu +ser/pwd log=loader.log"; } exit; # Don't forget to make the fifo disappear. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: writing to and reading from fifo
by Anno (Deacon) on Mar 26, 2007 at 09:51 UTC | |
by f00li5h (Chaplain) on Mar 26, 2007 at 10:15 UTC | |
by diomedea (Sexton) on Mar 26, 2007 at 11:10 UTC | |
by Anno (Deacon) on Mar 26, 2007 at 12:58 UTC |