BEGIN {
# START add a host independant relative path to the @INC
my $cwd = "";
# $1 is the basedir , $2 the dir separator , $3 the file name without the file ext , $4 the file ext
$0 =~ m/^(.*)(\\|\/)(.*)\.([a-z]*)/;
$cwd =~ s/\\/\//g;
use Cwd 'abs_path';
#resolve the run dir where this scripts is placed
my $ScriptAbsolutPath = abs_path( $0 );
#debug print "\$ScriptAbsolutPath is $ScriptAbsolutPath \n" ;
$ScriptAbsolutPath =~ m/^(.*)(\\|\/)(.*)\.([a-z]*)/;
# get the run of the current dir
my $RunDir = $1;
#change the \'s to /'s if we are on Windows
$RunDir =~ s/\\/\//gi;
# add the run dir
push( @INC, $RunDir);
# split the string of the RunDir into parts , use the / as the delimiter
my @DirParts = split( '/', $RunDir );
# go 2 levels up from the cwd
for ( my $count = 0; $count < 2; $count++ ) { pop @DirParts; }
# resolve the product dir
my $ProductDir = join( '/', @DirParts );
# build the relative path for the lib dir
my $DirLibs = "$ProductDir/lib/perl/db" ;
# perldoc perlvar search for @INC
push( @INC, $DirLibs) unless (grep {$_ eq $DirLibs} @INC) ;
#debug
print join ( "\ndir found in \@INC: \n" , @INC ) ;
# STOP add a host independant relative path to the @INC
} #eof BEGIN
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!