Re: [Boston.pm] Fwd: script works ok on command line, hangs when run from shell script

Mike Small <[email protected]>
Newsgroups gmane.comp.lang.perl.perl-mongers.boston
Message-ID <[email protected]>
Bill Ricker <[email protected]> writes:
> $| won't
> ​do what you want.
>
> perldoc -v '$|'
>
> HANDLE->autoflush( EXPR )
> $OUTPUT_AUTOFLUSH
> $|
>
> If set to nonzero, forces a flush right away and after every write or print
> on the currently selected output channel. Default is 0 (regardless of
> whether the channel is really buffered by the system or not; $| tells you
> only whether you've asked Perl explicitly to flush after each write).
> STDOUT will typically be line buffered if output is to the terminal and
> block buffered otherwise. Setting this variable is useful primarily when
> you are outputting to a pipe or socket, such as when you are running a Perl
> program under rsh and want to see the output as it's happening. This has no
> effect on input buffering. See getc for that. See select on how to select
> the output channel. See also IO::Handle.
>
> Mnemonic: when you want your pipes to be piping hot.
>
> ​ If you want actual non-blocking output in an output pipe or to a file, I
> _think_ you'll need
> ​
> perldoc IO::Handle
>
> ​*$io->blocking ( [ BOOL ] )*
>
> If called with an argument blocking will turn on non-blocking IO if BOOL is
> false, and turn it off if BOOL is true.

I thought he just wanted not to have the output block buffered. Isn't
this orthogonal to that? I.e. non-blocking output eq asynchonous output.
I.e. his script would carry on after a write but output still won't come
out the other end of the c library's buffer until Perl gives it a
block's worth?

-- 
Mike Small
[email protected]

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.