On Fri, Nov 08, 2002 at 10:46:43AM +0100, Joan Picanyol i Puig wrote:
> I'm noticing some weird behaviour having perl writing to pipes (they eat
> my output):
>
> grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$ cat shownextrun
> #!/usr/bin/perl -w
> print('sleeping; next run at: ',
> scalar(localtime(time()+$ENV{'DELAY'})), "\n");
> exec({ $ARGV[0] } @ARGV);
>
> grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$ DELAY=1 ./shownextrun true
> sleeping; next run at: Fri Nov 8 10:44:21 2002
>
> grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$ DELAY=1 ./shownextrun true | cat
> grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$
You may find that appropriate use of the $| special variable (or
equivalently the autoflush method of the IO::Handle object) suddenly
makes things work a lot better.
Either that, or always write to a pipe in chunks of 4K at a time...
Hmmm... This only seems to affect perl-5.00503 --- perl-5.6.1 works
for me in the way you expect without any extra flushing.
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message