Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Directory independent processing

by Tanktalus (Canon)
on Oct 16, 2012 at 23:21 UTC ( #999443=note: print w/ replies, xml ) Need Help??


in reply to Directory independent processing

Generally, I use moritz' second-last listed approach, "Search relatively to the installation path of the binary" (well, of the script).

use File::Spec; my $project_dir = File::Spec->catdir( File::Spec->rel2abs(__FILE__), F +ile::Spec->updir() );
I put that in my main script, right near the top, maybe in a BEGIN block if I have to:
use File::Spec; my $project_dir; BEGIN { $project_dir = File::Spec->catdir( File::Spec->rel2abs(__FILE_ +_), File::Spec->updir() ); }
and then everything is relative to that. I used to use this to create my @INC path, but have recently been shown rlib which takes care of that for me now :-)


Comment on Re: Directory independent processing
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999443]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2015-08-01 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls