in reply to Forwarding functions to a different module

Can't @ISA be used here?

From perlmod:

a package may also derive some of its methods from another class (package) by listing the other package name(s) in its global @ISA array (which must be a package global, not a lexical).
By using @ISA, no forwarding functions are needed if the methods are the same, so it's more efficient. It's also the standard practice. Is there some reason @ISA doesn't work in this situation?

Note: I'm no expert and don't know whether using @ISA invokes the AutoLoader, which you seek to avoid, but were I in your shoes I'd be doing inheritance in the standard way using @ISA and then dealing with any AutoLoader issues.

Update: I'm not clear on your constraint not to use 'bless', but the @ISA behavior works without bless. Note that the example in 'perlmod' is introduced as 'a traditional, non-OO module called Some::Module', yet it includes

@ISA = qw(Exporter);
(Updated again to ask about ISA working in this situation.)

Replies are listed 'Best First'.
Re^2: Forwarding functions to a different module
by rovf (Priest) on Aug 08, 2008 at 06:45 UTC
    I'm not clear on your constraint not to use 'bless', but the @ISA behavior works without bless.

    This was my misunderstanding. I thought @ISA works only when a function is called indirectly via a blessed reference! I will try out whether your suggestion works also in my context (the difficulty is that my module will be used as mixin together with other modules, in order to form one big class, using Class::MixinFactory, and I don't know yet to what extent this effects package lookup (maybe it would be a good idea to study MixinFactory a bit).

    -- 
    Ronald Fischer <ynnor@mm.st>
      I thought @ISA works only when a function is called indirectly via a blessed reference!

      You were close. It only works for method dispatch. (Constructor calls use method dispatch even though they lack references of any kind, blessed or otherwise.)

      The A Class is Simply a Package section of perlobj explains how @ISA and inheritance work. I should have linked it in my earlier post.

      I'd recommend reviewing all of perlobj, not just the section mentioned above.