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

Howdy all,

For some reason the first attempt to post this was blank, so I am trying again now, sorry.

I am writing a perl mp3 streamer, and am experiencing problems with getting it working with winamp. Basically it occasionally will block on the print which is sending the data out to the clients. This all seems to work fine but I have come across a major problem, if it is blocked on a print when winamp disconnects perl will just quit back to the shell, even if perl is loaded using a debugger. Oddly enough it does not do this if it is blocked and xmms disconnects. I am going to try to use syswrite and sysread instead of print to see if this solves the problem, but does anyone have an idea of how I can debug it to find out what is on when the whole of perl dies (with no error), even the perl debugger.

Thanks

Toby

Replies are listed 'Best First'.
Re: Sockets and blocked print.
by jepri (Parson) on Feb 26, 2002 at 01:43 UTC
    Assuming you are on *nix you should be getting some kind of indication of why perl was terminated. Since you are printing on sockets my immediate wild guess would be terminated for writing to a broken pipe. Try installing signal handlers using %SIG{xxxx} to see if you are being terminated like that.

    Finally, if you are writing a server, just fork before you start printing. That way you don't care if the printing process dies or not.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.