|There's more than one way to do things|
Autoloading tie routinesby cmac (Monk)
|on Feb 02, 2009 at 17:24 UTC||Need Help??|
cmac has asked for the
wisdom of the Perl Monks concerning the following question:
This got buried so I'm putting it up again at the top level.
I have a problem with a naming structure inherited from the guy who wrote a package that I'm working to supersede. Say the module/package is named XYZ::ABC. Using this package, people want to tie to names like XYZ::ABC::Scalar. The way he did this was to write out the names of the tie routines in full in ABC.pm, like this:
This works in preloaded form, but it seems it can't be autoloaded.
What do can I do to keep the inherited naming structure and autoload the tie routines? Can I put multiple package statements/sections in my one ABC.pm file?
If each package needs a separate .pm file, the changes to my Makefile.PM will be extensive. Do I recall a bit in the ExtUtils::MakeMaker docs about handling multiple things in one Makefile.PM?
In all there are 6 "tie-to" names and 52 "tie interface" routines. Even though each one has a pretty simple structure like:
52 of them make autoloading seem worthwhile. Although if they are in separate packages, each one containing only the tie routines for one "tie-to" name, maybe autoloading isn't worthwhile?
Thanks to any monk who can help,