If I understand you suggest to use rel2abs of File::Spec. As far as my understanding goes it is still tainted so while it might be better than FindBin (see the other node) but it still does not solve my problem.
#!/usr/bin/perl -T
use strict;
use warnings;
use File::Spec ();
use File::Basename ();
my $path;
BEGIN {
$path = File::Basename::dirname(File::Spec->rel2abs($0));
if ($path =~ /(.*)/) {
$path = $1;
}
}
use lib File::Spec->catdir($path, '..', 'lib');
use CGI;
print CGI->new->header;