From: Jonathan Stowe <[EMAIL PROTECTED]>

>So whats wrong with StatInc ?

OK, so StatINC will reload the module if the module source has changed. 
However, it's the handler I am pushing onto @INC that will generate the 
module source from a configuration file. If the configuration file changes, 
then the module needs to be regenerated and reloaded. I can't rely on a scan 
of %INC because the trigger for reloading the module is not the change of 
the module source, but the change in a secondary source.

Yes, one alternative would be to have a program monitor the configuration 
files and regenerate the modules whenever the configuration files change, 
but I'd prefer to have the regeneration occur when/if it is needed.

May be this will clarify what I'm trying to do (or let someone see where I 
have missed the boat):

sub generate_modules { .. }

use lib \&generate_modules;

...

require Module;

Module.pm doesn't exist, but Module.conf does, and generate_modules() 
converts Module.conf into Module.pm which is then loaded.

Later, while the program is still running, Module.conf changes, and I'd like 
a further call to

require Module;

(after the change in Module.conf) to regenerate and reload Module.pm.

By removing an entry in %INC I can get require to call generate_modules() 
again, even though Module has already been loaded.

My original question was concerned with trying to stop the unnecessary 
recompilation of Module.pm that results when its entry in %INC is removed 
and

require Module;

is called, but there has been no change to the configuration file, and hence 
no need to regenerate or reload the .pm file.

I am trying to implement transparent module creation so that in the program 
I don't have to know about the configuration files, and can treat them as 
normal modules.

If none of this makes any clear sense then I'll disappear and think some 
more.

Thanks for your suggestions and patience.



Ian

(who should have paid more attention during his formative years to learn how 
people communicate effectively)
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Reply via email to