note
Tanktalus
<p>Generally, I use [moritz]' second-last listed approach, "Search relatively to the installation path of the binary" (well, of the script).
<c>
use File::Spec;
my $project_dir = File::Spec->catdir( File::Spec->rel2abs(__FILE__), File::Spec->updir() );
</c>
I put that in my main script, right near the top, maybe in a BEGIN block if I have to:
<c>
use File::Spec;
my $project_dir;
BEGIN { $project_dir = File::Spec->catdir( File::Spec->rel2abs(__FILE__), File::Spec->updir() ); }
</c>
and then everything is relative to that. I used to use this to create my @INC path, but have recently been shown [mod://rlib] which takes care of that for me now :-)</p>
999160
999160