FROM : Sherm Pendley
DATE : Sat Nov 30 19:47:49 2002
On Saturday, November 30, 2002, at 10:27 AM, mw wrote:
> Oops, nevermind everybody. I was forgetting to send closeFile to the
> file
> handle I was using for writing. Some simple slightly-longer research
> did the
> trick!
Perl's output is line-buffered by default, which means the parent
program won't be able to read anything until the Perl program sends a
newline.
Closing the input to your Perl program will work, if your Perl program
is basically just a filter - something like this:
while (<>) {
...
}
In the above case, the Perl program ends when it runs out of input, and
when it ends, anything left in its output buffer is flushed.
In cases where more interactivity is required, where you need to gather
some output from the program without waiting for it to end, you can turn
off Perl's line-oriented output buffering. You do that by setting $| to
a true value. A memory aid - it's the pipe symbol, so set it to true if
you want piping hot output. Corny, I know - but it works for me. If you
use the English module, you can also refer to it as $OUTPUT_AUTOFLUSH.
sherm--
If you listen to a UNIX shell, can you hear the C?
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Sat Nov 30 19:47:49 2002
On Saturday, November 30, 2002, at 10:27 AM, mw wrote:
> Oops, nevermind everybody. I was forgetting to send closeFile to the
> file
> handle I was using for writing. Some simple slightly-longer research
> did the
> trick!
Perl's output is line-buffered by default, which means the parent
program won't be able to read anything until the Perl program sends a
newline.
Closing the input to your Perl program will work, if your Perl program
is basically just a filter - something like this:
while (<>) {
...
}
In the above case, the Perl program ends when it runs out of input, and
when it ends, anything left in its output buffer is flushed.
In cases where more interactivity is required, where you need to gather
some output from the program without waiting for it to end, you can turn
off Perl's line-oriented output buffering. You do that by setting $| to
a true value. A memory aid - it's the pipe symbol, so set it to true if
you want piping hot output. Corny, I know - but it works for me. If you
use the English module, you can also refer to it as $OUTPUT_AUTOFLUSH.
sherm--
If you listen to a UNIX shell, can you hear the C?
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| mw | Nov 30, 16:24 | |
| mw | Nov 30, 16:27 | |
| Sherm Pendley | Nov 30, 19:47 | |
| mw | Nov 30, 20:03 | |
| Sherm Pendley | Nov 30, 21:29 |






Cocoa mail archive

