"be consistent" | |
PerlMonks |
Perl/Tk command execution weirdnessby Guildenstern (Deacon) |
on Dec 11, 2000 at 22:48 UTC ( [id://46112]=perlquestion: print w/replies, xml ) | Need Help?? |
Guildenstern has asked for the wisdom of the Perl Monks concerning the following question:
I have an app written in Perl/Tk. I am having a very strange problem in relation to the Button and Entry widgets. On one dialog I have an Entry widget and a Button. When the Button is pressed, I want to call a sub with the current contents of the Entry widget. Here is the code that attempts to do this:
This code successfully calls the newDir sub, but no value gets passed in. This led me to think that the get() wasn't returning anything so I tried this line instead:
Making this substitution prints out the correct information when the button is clicked. Why can I only access the contents of the Entry through the anonymous sub? Why does it not seem to pass the value to the newDir sub? Is there some kind of scoping or execution order problem that I'm not aware of here? I'm sure I could wrap the call to newDir in an anonymous sub in the command handler, but the thought of doing that makes me cringe. Guildenstern Negaterd character class uber alles!
Back to
Seekers of Perl Wisdom
|
|