forked from PASApipeline/PASApipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pasa_init.pm
executable file
·45 lines (34 loc) · 1.14 KB
/
Pasa_init.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/local/bin/perl
## Pasa initialization
# setting PASAHOME env variable
# PASAHOME should either be the current working directory or the parent dir.
use FindBin;
BEGIN {
## Ensure that PASAHOME env var is set.
## Find PASAHOME by looking for the pasa_conf directory.
unless ($ENV{PASAHOME}) {
my $path = $FindBin::Bin;
if (-d "$path/pasa_conf") {
$ENV{PASAHOME} = $path;
} elsif (-d "$path/../pasa_conf") {
$ENV{PASAHOME} = "$path/../";
} else {
## Search the Perl Lib Path.
foreach my $lib (@INC) {
if (-d "$lib/pasa_conf") {
$ENV{PASAHOME} = $lib;
last;
}
if (-d "$lib/../pasa_conf") {
$ENV{PASAHOME} = "$lib/../";
last;
}
}
unless ($ENV{PASAHOME}) {
die "ERROR, cannot find the 'pasa_conf' directory. It should be the current directory or the parent dir.\n\n";
}
}
}
}
use lib ("$ENV{PASAHOME}/PerlLib/", $ENV{PASAHOME});
1;