At 02:05 PM 8/19/02 -0700, Randy J. Ray wrote: >>Because routines are loaded when they are requested, they may be loaded in >>child processes, causing duplication in memory because they are not shared. >>They would be shared if they would be loaded in the initialization phase >>before the child processes are forked. But in that phase you wouldn't call >>all of those routines that you might need in the child processes. >The problem I would anticipate would be in having a portable way of locating the code >to load without having it executed. You could pull some functionality out of >AutoLoader, but then you have code duplication.
Indeed. Most of the necessary code is in AutoLoader::import and AutoLoader::AUTOLOAD already. >Or, an idea that just hit me, you could provide a call in the AutoLoader module that >does the job for you. It would have access to all the logic already in the module, >and module-writers could use it conditionally a la: > AutoLoader::preload(__PACKAGE__, @routines) > if $running_under_modperl; >Where the @routines list is optional, and defaults to every *.al file found for >__PACKAGE__. I was more thinking along: use AutoLoader; # current behaviour use AutoLoader 'AUTOLOAD'; # import AUTOLOAD 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? Liz