controlchan testing

Russ Allbery rra at
Wed May 9 13:03:26 UTC 2001

Marco d'Itri <md at Linux.IT> writes:

> May be. In my new programs which work as INN channels I always put:

> { my $oldfh = select STDIN; $| = 1; select $oldfh; }

> maybe it should go in controlchan too.

Hm.  I'm pretty sure that doesn't do anything.

autoflush HANDLE EXPR
$|      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 the getc
        entry in the perlfunc manpage for that.  (Mnemonic: when you want
        your pipes to be piping hot.)

Note the third from the last sentence.

The whole concept is also somewhat incompatible with doing line-at-a-time
reading from the input channel; you pretty much have to read ahead to find
the newline, and then there's no way to put the data back.

I think what this is arguing is that my previous assumption was wrong and
that in fact it is a problem if controlchan exits, and that controlchan
probably shouldn't do so except for some error that's completely
unrecoverable, since it could result in not processing some control

Russ Allbery (rra at             <>

More information about the inn-workers mailing list