Here is an example
written using
Class::Factory
.
In my factory (Audio::Info),
I register all available types (look for register_factory_type, Audio::Info::Ogg and Audio::Info::MP3 for now) upon compilation,
and each type is loaded upon first use (I could've done add_factory_type instead, which would load each available type upon compilation of Audio::Info).
I hope that demonstrates it well enough.
| MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] |
Thanks for the examples PodMaster.
I *think* that the problem with this (for my application) is that it requires that each of the subtypes exist as seperate files? As I (belatedly) outlined elsewhere, the application requires that the packages be generated on demand (from information stored in the top level package, which itself is autogenerated from a set of large C header files). It would be possible to generate the hundreds of small .PM files directly, but the volume would make this messy and difficult to manage.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.
| [reply] |
the volume would make this messy and difficult to manage.
This is a Straw Man, BrowserUk. At a previous job, I managed over 10,000 (initially) auto-generated classes using two scripts. It's easy, once you have the system in place. (Putting the system in place is often worth the 2-3 days it takes to get right.) Plus, I believe a responder to the initial post pointed out a CPAN solution that might get 90% of the way there ....
------ We are the carpenters and bricklayers of the Information Age. The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6 Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
| [reply] |