in reply to pretending that the contents of a variable are files
This is effectively setting up the pipeline of "some_perl_widget | anotherprogram | your_program", but from within the program itself.defined(my $kid = open RESULT, "-|") or die "fork: $!"; unless ($kid) { # kid does: defined(my $grandkid = open PUMP, "-|") or die "child fork: $!"; unless ($grandkid) { # grandkid does: print @LotsOfDataHere; exit 0; } open STDIN, "<&PUMP" or die "Cannot dup PUMP to STDIN: $!"; exec "anotherprogram"; die "exec anotherprogram: $!"; } while (<RESULT>) { # process the large result ... }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|