Fellow monks,

I am in the process of writing a Perl/Tk program to watch stocks during the day while I'm at work. I used to use a free application to do this, but it's suddenly failed, and the author's web site is unreachable, so I'm trying to recreate his program in Perl.

All is well and good, but I'm stuck on how to do a hyperlink in Tk. I've looked on the web, in Mastering Perl/Tk and in Super Search and come up empty.

The closest I've found is the psuedo code from the Mastering book and it's not helping. I understand the bit

$t->tagBind('goto_stock',"<Button-1>", sub{ ?? });

but I'm stuck on what exactly to call in the subroutine. I know I could just do `iexplorer` or `mozilla` but that doesn't seem right and I don't want to hard code a browser in to the program.

How would Tk know that I want to bind to a hyperlink? Is there a generic way to determine what the default browser on the system is?

Also if there's an example of this somewhere that I've missed, I'd really appreciate it if someone could let me know.

Update: Sorry I didn't make it clear initially, but I want to be able to use the binding to a hyperlink to visit Yahoo Finance to get to the page for the stock in question - e.g. GE, not to watch the quotes in a browser window. The quotes are being updated from a CSV file that I'm grabbing from Yahoo.

There is no emoticon for what I'm feeling now.


In reply to Binding hyperlinks to text using Perl/Tk by Popcorn Dave

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.