in reply to appropriate name/place for module which does JIT loading of modules

Are you aware of autouse, which is in the core?

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
  • Comment on Re: appropriate name/place for module which does JIT loading of modules

Replies are listed 'Best First'.
Re^2: appropriate name/place for module which does JIT loading of modules
by sakoht (Initiate) on Dec 16, 2007 at 21:16 UTC
    Thanks for the feedback.

    I was not aware of the autouse pragma. Sadly, it requires that the module name be explicit (no regex, no callback), and that the subroutine names which should trigger loading also be explicit. It seems at first glance to do what Class::LazyLoad does, though there may be subtle details I've missed.

    I did discover Class::Autouse and also the "later" pragma in the process of finding "autouse", though. These both much closer to my module.

    Both of these require explicit package names, but use AUTOLOAD so they can be method agnostic. The "later" pragma seems to have more features, but none I need, and with the additional restriction that it only applies in the namespace it is used-from, which will break things for me.

    Thanks for pointing me in the right direction!
    I'll contact the authors now...

      I've sent a patch to Adam Kennedy, author of Class::Autouse, after some discussion. It seems that this is the one of the group which is actually used in production, while the others are proof-of-concept, experiments, etc.