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';
}
}
In reply to Conditional 'use lib' by bjdean
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |