On 2002.08.19 13:53 Elizabeth Mattijsen 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.
I don't know of a module or "standardized" way of doing this, but the CGI module offers this to the user in the form of a "compile" directive in the imports list. It tells the module proper to pre-compile the specified list of routines, and (as I understand it) the functionality stemmed from the kind of situation you describe, where application developers wanted to ensure that load-on-demand functions be pre-loaded before forking. 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. 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__. 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