Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Tk module subs executes without invocation

by dannoura (Pilgrim)
on Aug 29, 2005 at 15:45 UTC ( #487445=note: print w/ replies, xml ) Need Help??


in reply to Re: Tk module subs executes without invocation
in thread Tk module subs executes without invocation

Magic. Thanks! That works. Can you explain why?

Also, another question: now that I ported all the subs from the script into a module the script reports:

Assuming require 'Tk::BrowseEntry' at FP_GUI.pm line 151; Assuming require 'Tk::ProgressBar' at FP_GUI.pm line 169;
Also something which it hasn't done before (this is despite a use Tk; statement at the beginning of the module and script). Why is that?


Comment on Re^2: Tk module subs executes without invocation
Select or Download Code
Replies are listed 'Best First'.
Re^3: Tk module subs executes without invocation
by Tanktalus (Canon) on Aug 29, 2005 at 16:28 UTC

    You can only take a reference to a subroutine of some sort in perl5 (perl6 will have more sophisticated binding to allow you to pre-populate certain parameters and pass that code ref around instead of the original routine). So here what I'm doing is creating an anonymous sub that is also a closure - it's closed on $self, retaining the current value of $self at the time of this routine. It then calls the routine we want with the parameters we want - even though the Tk code can't know what $self is to pass it in.

    As to your assuming lines - I'm not sure, I'm not a Tk user. ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://487445]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2015-07-29 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls