Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
There's more than one way to do things
 
PerlMonks  

Re: use lib in cgi env

by sundialsvc4 (Monsignor)
on Nov 05, 2012 at 15:08 UTC ( #1002338=note: print w/ replies, xml ) Need Help??


in reply to use lib in cgi env

In a recent (FastCGI) application main-script, I once did this:

BEGIN { if (-f '/opt/location1/configuration.pm') { ## production environment: unshift( @INC, '/opt/location1/lib', '/opt/location1/scripts' ); } else { ## dev environment: unshift( @INC, '/opt/location2/lib', '/opt/location2/scripts', '/opt/location3/debug_lib' ); } }

The BEGIN block’s contents are executed before compilation begins, and therefore can be used to determine things such as library locations.   This example used the existence of a particular file in a particular location to decide where the libraries would be.   The use lib nomenclature was not used.

Developers relied upon setting the PERL5LIB environment variable to establish the library-location (appropriate to their particular machines), as the above mechanism would not have been invoked as they wrote and tested their code.

I’m not saying that this is the only way nor necessarily the best one.   But, it did work.


Comment on Re: use lib in cgi env
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002338]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-04-19 00:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (474 votes), past polls