in reply to Re^2: autoloading tie routines
in thread autoloading tie routines

It occurs that I have a problem with naming structure inherited from the guy who wrote the package that I'm working to supercede. He (I) have a module/package named IPC::MM (IPC::MMA).

Using this, people want to tie to names IPC::MM::Scalar and IPC::MM::Hash (IPC::MMA::Scalar, IPC::MMA::Array, IPC::MMA::Hash). The way he did this was to write out the names of the tie routines in full in MM.pm, like this:
# Preloaded methods go here. sub IPC::MM::Scalar::TIESCALAR { my $class = shift; my ($val) = @_; return bless \$val, $class; }
This works in preloaded form, but it seems it can't be autoloaded.

In my .xs file there is a nice little header:
MODULE = IPC::MMA PACKAGE = IPC::MMA
and one can have other headers that vary these names. But I don't know of any comparable structure on the .pm side. Assuming that I want to keep the inherited naming structure, what can I do in the .pm file (files?) to straighten out this mess?

cmac
www.animalhead.com

Replies are listed 'Best First'.
Re^4: autoloading tie routines
by ysth (Canon) on Feb 03, 2009 at 01:21 UTC
    I'm not sure I'm understanding your situation, but if you want a function in IPC::MM::Scalar autoloaded, you should have an IPC::MM::Scalar::AUTOLOAD subroutine. Since I suspect you don't need the constant() stuff in that package, you could just do (in a Scalar.pm file):
    package IPC::MM::Scalar; use AutoLoader 'AUTOLOAD'; 1; __END__ sub TIESCALAR { ...