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

Does anyone have any advice on how someone would implement a stock market type of stream to a web browser? I would like to make the updates real time. Just like the stock market! Would JavaScript be the key tool to use, or would some other type of tool/language be better? I need someone to point me in the right direction. Thanks.

Comment on stock ticker feed|er
Re: stock ticker feed|er
by tilly (Archbishop) on Jan 14, 2009 at 06:29 UTC
    The technology that you're looking for is called AJAX. It is based on having JavaScript on the browser use the XMLHttpRequest object to query your web page for updates. When it finds an update the JavaScript then dynamically updates the current page.

    CGI::Ajax is supposed to make setting this up easier. I haven't used it so I can't recommend it either way, but it may give you a place to start.

Re: stock ticker feed|er
by BrowserUk (Pope) on Jan 14, 2009 at 07:55 UTC

    There is an alternative to AJAX that is far simpler for simple (non-interactive) uses.

    Decried and eshewed as they are, IFRAMEs are simple to use. Combined with a <META HTTP-EQUIV=Refresh..., they are the simplest way to provide dynamic updates without full page refreshes.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Do you know where I can go to get the stock prices in real time? DO you know how that works?
        The code zentara mentioned uses Finance::YahooQuote to fetch that info. I don't know how fresh the quotes are, but they should be quite fresh if not up to date.
Re: stock ticker feed|er
by zentara (Archbishop) on Jan 14, 2009 at 11:30 UTC
    If you are willing to get away from the Browser, you can use Tk, or Gtk2, etc. This is very simple. You can make a scrolling display easy enough, but the following is less distracting and updates every so often(30 secs). See Cheap Stock watch with Tk

    I'm not really a human, but I play one on earth Remember How Lucky You Are