hotshot has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks!

Are there any perl commands, end of block, situations or something else that when they finish they send a pipe signal.I stumbled something very weird, I have a signal catcher function that is called when I send the pipe signal to my program (that's working for a long time), but it seems somehow that it gets called in other situations that I still haven't been managed to track.
All the weird thing started when I added several local blocks in my functions (for changing environment variables temporarly). Is it possible that when the local block ends it sends a pipe signal? anyone has an idea?

Hotshot

Replies are listed 'Best First'.
Re: SIG PIPE
by blm (Hermit) on Oct 24, 2002 at 07:48 UTC

    First things first do you have code you can show us or some further information about what you are doing?

    I was writing a program once to read from a FIFO created with mknod p filename. The writer was squid and the reader was a perl script doing manipulations with the data before doing some SQL updates. I found that the program writing to the pipe (Squid) died with SIGPIPE when the reader wasn't reading fast enough or there wasn't a reader at all. I basically had to modify the reader to be able to suck data out of the pipe as fast or faster then the program writing to the pipe since then I rewrote the reader to simplify the SQL it was performing so it handled the data even faster. _If_ I remeber properly the reader died to with SIGPIPE or EOF when there wasn't anything in the pipe. I have read you should always have more then one reader on a pipe. I can't remember where though.

    I hope this is helpful in some way :-)

    --blm--
Re: SIG PIPE
by graff (Chancellor) on Oct 25, 2002 at 03:02 UTC
    Does your code open a pipeline file handle? When it runs, is it reading stdin from a pipe, or writing stdout to a pipe on the shell command line?

    It wasn't clear from your description, but are your "local blocks" trying to do something like:

    local %ENV; $ENV{FOO}="BAR";
    I'm not even sure whether this will run or generate some sort of error on its own, but I'd worry that the resulting behavior might not be what you'd expect -- I just don't know for sure, and I'm not sure what the appropriate test would be. (That is left as an exercise...)
Re: SIG PIPE
by hotshot (Prior) on Oct 24, 2002 at 07:38 UTC
    and another thing, the most frustrating thing is that I have two computers here, and this f*** thing happens only on one of them.

    Hotshot