Hi,
Sorry to pollute this list with a question about Perl...
I am writing a customer handler for loading modules at runtime, taking
advantage of the support for coderefs in the @INC array. By deleting entries
in the %INC hash for loaded modules I can force Perl to recompile the module
after it has been first loaded. This is particularly important with
mod_perl, since the modules themselves may change during the life of the
program.
Deleting an entry in %INC allows me to trap the request from a 'require'
call to load a module, even if it has already been loaded. If the module
should be recompiled, then I simply return a filehandle to the module
source. Sometimes, however, no recompilation is necessary, and so I'd like
to return a filehandle that "evaluates to true" (in the 'do <file>' sense of
evaluates), so that require thinks that it has successfully loaded and
recompiled the module (to avoid the overhead of unneccessarily recompiling
large modules).
Is there a way to do this without creating a dummy file (i.e. can we do this
in memory)?
I have tried using a tie'd filehandle, but the internal workings of require
mean that this doesn't work (unless, of course, I got my tie'ing wrong) as
none of the tie'd package methods are called.
Cheers,
Ian
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.