ezekiel has asked for the wisdom of the Perl Monks concerning the following question:

I have a CGI script running under Apache mod_perl. It uses a particular module, that exists in two locations, say:

/the/correct/location/Module.pm
/the/WRONG/location/Module.pm

The Apache configuration must preload the module from the WRONG location, as checking %INC at the very beginning of the script shows the module has indeed come from that location. I cannot change this configuration.

How do I force the script to reload the module from the alternate location?

I have tried several use lib statements but whenever I try to use the methods in the module, it is clear they are still coming from the WRONG version

Thanks

Replies are listed 'Best First'.
Re: Forcing modules to reload from a specific location
by nite_man (Deacon) on May 26, 2003 at 06:13 UTC
    First, use Apache::Reload in your modules:
    use Apache::Reload;
    Next, add in .htaccess a path to the location of your modules:
    PerlSetEnv PERL5LIB /the/correct/location
    It will help you force Apache to reload your modules when they will be modified.
          
    --------------------------------
    SV* sv_bless(SV* sv, HV* stash);
    
Re: Forcing modules to reload from a specific location
by pzbagel (Chaplain) on May 26, 2003 at 05:56 UTC

    You have two options, either you can change the @INC variable as your script starts up so it loads the correct module which I describe in my answer to a similar question or you can use the only module to load a specific version of a module or even load multiple versions of a module.

    HTH