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.

In reply to streaming audio by brillig

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.