Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Forcing modules to reload from a specific location

by ezekiel (Pilgrim)
on May 26, 2003 at 05:27 UTC ( [id://260775]=perlquestion: print w/replies, xml ) Need Help??

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://260775]
Approved by Enlil
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-19 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found