On 2002.08.19 14:19 Elizabeth Mattijsen wrote:

>   use AutoLoader 'preload';  # preload anything you can find in %INC
> 
>   use AutoLoader preload => { module => '' }; # all from specific module
> 
>   use AutoLoader preload => { module => [qw(suba subb)] }; # only specific
> 
> 
> Would that make sense?

Problem with that approach is that it doesn't offer any control over whether
you are pre-loading or not. If you are going to pre-load a certain sub-set of
routines all the time, just put them above the __END__ token and don't burden
AutoLoader with new functionality at all.

What I was suggesting was a way that I, as the writer of (picking one of my
own modules as an example) RPC::XML::Server can incorporate something in the
compile-time logic so that Apache::RPC::Server contains:

     use RPC::XML::Server 'compile';

And RPC::XML::Server can have:

sub import {
     AutoLoader::preload(__PACKAGE__, @list_o_routines)
         if (lc $_[1] eq 'compile');
}

(Admittedly a simplistic example, but I hope it gets the point across)

This way, I only pre-load routines in the cases where I need it done. Your
suggestion is good for modules that are only ever used under mod_perl, but
modules may be designed to work in other environments. Oh, you could manage
to get the same affect as my idea using a BEGIN block and conditional calls
of "use AutoLoader", but the above seems to me to be much cleaner.

Randy
-- 
-------------------------------------------------------------------------------
Randy J. Ray     | Men occasionally stumble over the truth, but most of them
[EMAIL PROTECTED] | pick themselves up and hurry off as if nothing had happened.
+1 650 930-9097  |   -- Sir Winston Churchill

Reply via email to