... but I wonder if anyone has seen a good book that covers OOPerl and Tk, or if they know of a tutorial, or even some well written OOPerl/Tk code that I could peruse.
Well, I don't know of a good book on that specific topic, however, Tk itself is pretty object oriented, so you may want to start there.
Quick Disclaimer: I dont know what you app does, so I am just gonna throw out some things I have done in the past in similar situations.
You can start by taking any custom behaviors you have implemented proceduraly and making them subclassed widgets. Even if you are only adding a single method, or pre-setting some configuration parameters in the widget constructor, it can still be worth it to subclass because of the possiblities for extensibility it gives you later on.
Probably another good place to start is to look at the Tk "MegaWidgets" out on CPAN. You may be able to combine groups of widgets into a single mega-widget if they get reused in other places.
You may also want to think of the different layers of your application as well. n-tier design ideas need not only apply in multi-tier settings. Break out any non-UI parts into their own objects. This can have added benefit later on when you may want to port it out of Tk and into some other platform.
Another thing that I have found very valuable when doing this type of work is to build some kind of regression test. Having some way you can be sure your changes did not break anything will save you a lot of time. Then you can refactor and make these changes incrementally and test after each one.
As for the global variable thing, you will likely be able to get rid of most of them in the refactoring process, for the rest of them, all I can say is Singletons.
Hopefully some of this will be useful to you :)
In reply to Re: OO Perl and Tk
by stvn
in thread OO Perl and Tk
by jdtoronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |