bjdean has asked for the wisdom of the Perl Monks concerning the following question:
Greetings folks,
I've recently come across a problem whereby I'd like to conditionally use 'use lib' (which doesn't work due to the early order of processing 'use' in compilation).
The question then, is there a better way then this:
BEGIN {
use Sys::Hostname;
if ( hostname() eq 'foo.bar.org' ) {
unshift @INC, ('/alternate/libdir');
} else {
unshift @INC, ('/default/libdir');
}
}
To achieve something close to to 'meaning' of:
BEGIN {
use Sys::Hostname;
if ( hostname() eq 'foo1.bar.org' ) {
use lib '/alternate/libdir';
} else {
use lib '/default/libdir';
}
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Conditional 'use lib'
by Chmrr (Vicar) on Feb 26, 2003 at 08:04 UTC | |
by Anonymous Monk on Dec 04, 2007 at 18:48 UTC | |
|
Re: Conditional 'use lib'
by Abigail-II (Bishop) on Feb 26, 2003 at 08:00 UTC | |
|
Re: Conditional 'use lib'
by PodMaster (Abbot) on Feb 26, 2003 at 08:03 UTC | |
|
Re: Conditional 'use lib'
by dbp (Pilgrim) on Feb 26, 2003 at 08:11 UTC |