in reply to Pipeing to a Tk-App
... and before you do this:open(VIRTUALPRN, "| perl print.pl");
you could try this:print VIRTUALPRN "foobar\n"
Or, more elegantly:select VIRTUALPRN; # make this the "default" output handle $|++; # disable output buffering on this handle
If you're only writing a small amount of content to that process, the default buffering would withhold output to the process until the file handle closes, which you could do explicitely in the parent process (rather than just exiting), but it's better to turn off buffering.use FileHandle; ... my $VirtualPrnFH = new FileHandle; $VirtualPrnFH->open( "| perl print.pl" ); $VirtualPrnFH->autoflush(1); # turn off buffering ... print $VirtualPrnFH "foobar\n"; ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pipeing to a Tk-App
by schweini (Friar) on Feb 17, 2003 at 05:56 UTC |