good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Of strict, globals, packages and styleby jdporter (Paladin) |
on Oct 20, 2005 at 19:00 UTC ( [id://501782]=note: print w/replies, xml ) | Need Help?? |
I think it's an excellent idea. What you've hit upon is called the Strategy design pattern. I like this pattern and I use it a lot. The fact that you invented it independently just proves that it's a real pattern. :-) The outline you illustrated is a framework. The dbi handle, ftp handle, etc. exist as Singletons within that framework. When you call the strategized methods, they're being called in the context of the framework, so you should probably pass a handle to that context to the called method. Using that handle, the method can get at the singleton objects that live in the framework. When you've achieved this, you won't need any real global data at all. (The "global" data can easily be limited to lexicals in the main program file.)
We're building the house of the future together.
In Section
Seekers of Perl Wisdom
|
|