Orsmo has asked for the wisdom of the Perl Monks concerning the following question:
So I started writing some OO code. I designed my objects and started writing an AUTOLOAD to create data accessors. I knew I wanted to do some pretty funky stuff, so I figured Class::MakeMethods and company probably wouldn't be quite as flexible as I needed them to be. After reading the docs and writing some sample code though, I think I might change my mind. The problem is though that one of the things my code does doesn't seem to be in any of the method generating modules I've looked at so far.
My objects (implemented as hashes) have some keys that are associated with references to other hashes. The keys in those hashes in turn point to references to objects. Such a structure just doesn't seem to be available in Class::MakeMethods, etc. They have methods for arrays of objects and tied hashes of objects, but no simple hashes of objects.
Is there something that I'm missing? Is there some reason that it makes no sense to do what I'm doing? I can just use the plain old hash methods and hack up some way to handle delegation, or I can use the array of objects methods and hack up some sore of indexing functionality with hooks in the data accessors to update the indexes, but that seems like more work that it should be if I'm using a general purpose method making module... *sigh*
Maybe I should go back to writing ten tons of closures for my cacheing AUTOLOAD. Anyone want to drop some Wisdom™ on me?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why isn't it in Class::MethodMaker or Class::MakeMethods?
by lachoy (Parson) on Nov 14, 2002 at 04:46 UTC |