in reply to Re^3: $Bin undef with FindBin in web environment
in thread $Bin undef with FindBin in web environment
For future reference for anyone who may need it, the entire section of code I'm using to determine the location of lib, where I have a directory structure like 'client/project/*' (where I have bin, cgi and lib at the * level and want my local lib first is:
BEGIN { use Cwd qw/abs_path/; use File::Spec::Functions qw/rel2abs/; my $path = rel2abs(abs_path($0)); if ($path =~ m,^((?:/\w+)*?/)(?:cgi|bin)/,) { unshift @INC, $1.'lib'; } else { die "Unable to determine lib path from $path"; } };
|
|---|