http://qs321.pair.com?node_id=361313

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

I found an example of how to set up an http stream client (ie: icecast client) in perl here.

However, for the project i'm working on, I need th audio output to be buffered. I've tried a hundred different ways of doing this, and it always skips or jumps or repeats itself no matter what I do.

Is perl even capable of quickly buffering output like this?
clarifications:
Yes, I understand the concept of buffering. So far I've tried essentially 2 ways:

1. fill a FIFO array with data read from the input stream. print the shifted data off the array to the player stream and get more data in a loop.
2. do the same thing, but with a string instead of an array, and use a fixed output size.

Neither of these work, at least not the way I'm doing it. I had some suggestions about setting the input stream to be non-blocking (using fcntl), which sort of works, but still doesn't solve the underlying issue: the buffer needs to be constantly printing to the player stream, even if we're waiting for input from the input stream.