in reply to Re: Style and Coding Criticism (part 2)
in thread Style and Coding Criticism (part 2)
I've been known to use this same approach myself for self-contained Perl/Tk apps of similar size (even larger) -- a global hash that holds all the widgets makes it easy to access any given widget from within any given callback subroutine, and this is handy when the callback for some widget or bound event has to reconfigure one or more other widgets, which might be anywhere else in the GUI.
Given sensible hash key strings, this seems easy enough to maintain (and to "add features" or change the app's behavior later on, when needed). So, I know globals are "naughty" for various good reasons, but they can be a viable option -- they do have their place, I think.
If there is a better way (without the global hash) in such a case, I'd be grateful to see it. (I come here to learn stuff like that.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re3: Style and Coding Criticism (part 2)
by dragonchild (Archbishop) on Aug 06, 2003 at 12:58 UTC |