> Lets say I have two directories :
> /cgi-bin/dir1 i /cgi-bin/dir2
> and in every of them I have module conf.pm (configuration module).
> Of course the first using one of the module causes cache'ying
> it by mod_perl (using Apache::Registry or Apache::PerlRun).
> When I use 'use conf' from the other dir it sees the first included
> by perl_mod conf module (because it is present in global %INC)
I'm not familiar with the guts of Apache::Registry, so the following are
just things to try.
Possible solution 1
===================
Try using a path when 'using' the file:
- BEGIN { require '/foo/bar/dir1/conf.pm'; }
- BEGIN { require '/foo/bar/dir2/conf.pm'; }
(also call import() if it exists.)
Possible solution 2
===================
Unload the module before loading it by clearing the appropriate %INC and
by clearing the namespace. PerlRun has a function with clears the
namespace which one can use even if it's not a PerlRun script.
Possible solution 3
===================
Instead of use() or require(), use do(). mod_perl won't cache it. This
may require modifications and you can't polute the namespace unless you
undo the changes before existing.
If conf.pm simply returns configurations values, it could be rewritten
like:
# conf.pl
my $sub = sub { return 'bla'; }; # doesn't pollute namespace
{
a => 'foo',
b => 'bar',
c => &$sub(),
};
# main.pm
my $config = do('conf.pl');
Take your pick!
ELB
> BTW Merry X-mas and happy Y2K ;o)
At least you didn't say millenium :-)
--
Eric L. Brine | Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED] | Do you always hit the nail on the thumb?
ICQ# 4629314 | An optimist thinks thorn bushes have roses.