[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with PERL 5.10 and system pipe



On Thu, 24 Sep 2009 15:58:30 +0300, Damyan Ivanov wrote:

> > gregoa@colleen:~$ perl -MFcntl -e 'sysopen(PH, "/tmp/fifo", O_NONBLOCK)'
> > gregoa@colleen:~$ 
> But is the file handle returned ready to be read from?
> 
>   $ perl -MFcntl -we 'use autodie; use strict; sysopen(PH, "test", 
>   O_NONBLOCK); print readline(PH)'
>   $
> 
> (i.e. no hang even on reads)
> And this doesn't read from the pipe even if I do "echo some > test" 
> beforehand. Something is not right.

Right, it seems to read if something's written to the pipe at the
moment of reading.

Terminal 1:
gregoa@colleen:~$ while :; do echo bla > /tmp/fifo ; sleep 1 ; done

Terminal 2:
gregoa@colleen:~$ perl -MFcntl -e 'sysopen(PH, "/tmp/fifo", O_NONBLOCK); print readline(PH)'

Sometimes echos 'bla' and sometimes not.
 
Hm, somethings missing in the puzzle.

Cheers,
gregor 
-- 
 .''`.   http://info.comodo.priv.at/ -- GPG Key IDs: 0x00F3CFE4, 0x8649AA06
 : :' :  Debian GNU/Linux user, admin, & developer - http://www.debian.org/
 `. `'   Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/
   `-    A woman should have compassion.  -- Kirk, "Catspaw", stardate 3018.2 


Reply to: