Clean up library path fiddling across all scripts

This commit is contained in:
Oliver Gorwits
2014-03-11 21:40:58 +00:00
parent 58ffd7a53a
commit 47d712490e
11 changed files with 85 additions and 47 deletions

View File

@@ -1,11 +1,12 @@
#!/usr/bin/env perl
our $home;
our $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
BEGIN {
# try to find a localenv if one isn't already in place.
$home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
use FindBin;
FindBin::again();
# try to find a localenv if one isn't already in place.
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
use File::Spec;
my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
@@ -16,14 +17,10 @@ BEGIN {
die "Sorry, can't find libs required for App::Netdisco.\n"
if !exists $ENV{PERLBREW_PERL};
}
}
use FindBin;
FindBin::again();
use Path::Class 'dir';
use Path::Class;
BEGIN {
# stuff useful locations into @INC
# stuff useful locations into @INC and $PATH
unshift @INC,
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
dir($FindBin::RealBin, 'lib')->stringify;