It has to do with that thing that I have a hard time describing in my post (see below yours). Since these callbacks are generated within a callback, I don't believe the anonymous subs are eval'ed until the dbclick callback is complete. Since the $fullpath is global to the sub all three callbacks end up with the same value for $fullpath when they are created.

This is why I think using anonymous subs for callbacks is a bad thing - especially when created dynamically like this. Too much potential for action at a distance. I prefer the nice, predictable method of passing an anonymous array to the callback mechanism and letting Tk deal with that. Besides, the fact that the callback then passes the parent widget's ref to the subroutine with this method is immensly useful sometimes. (For example using dynamic callbacks with multiple canvas methods, each of which could use the same callback sub and potential share the same tag name.)

{NULE}
--
http://www.nule.org


In reply to Re: Re: Tk tagBind problem by {NULE}
in thread Tk tagBind problem by arc_of_descent

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.