mwb613 has asked for the wisdom of the Perl Monks concerning the following question:
Sorry for the long title, I'm having trouble articulating just the issue I'm having
Basically I'm wondering what is the best way, without using absolute paths, to set up my files so that modules AND non-modules (such as YAML files) can be referenced easily in a script. I often reference a module using "use lib()" and those modules often reference yaml files using absolute paths. I've come to realize that if I move those files to other computers I cannot easily set up the paths so everything is included properly (see below for more info). Even if I start keeping the modules in the same DIR as the script (or one level below in a modules DIR for example) I cannot use relative paths in the case that the script is not run from the directory that it resides (if Cron were running it for example).
What is the best practice to ensure portability for modules and other files a script might need to reference?
Here's why I'm asking:
Up until this point I have been working with Perl with only two different Linux machines where. I set up the directory structures identically so when I wanted to move a script from one machine to another I just needed to copy it and any "use lib" includes I wanted would work fine.
I now have a few more machines, VMs, etc and thought it would be a good idea to set up source control for additional users, etc. So I created a few GIT repositories and realized, as I was trying to add files into the repo so they could be replicated to other machines, I could no longer use a hierarchy where I put all PM files in a single dir and all YAML files in another and still break the repo into smaller projects rather than a big monolithic repo (there would be issues even with that since the placement of the cloned repo is not assured.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with Best Practices for Module Paths when scripting across multiple machines
by boftx (Deacon) on Nov 07, 2014 at 23:41 UTC | |
|
Re: Help with Best Practices for Module Paths when scripting across multiple machines
by RonW (Parson) on Nov 07, 2014 at 22:30 UTC | |
by mwb613 (Beadle) on Nov 07, 2014 at 23:33 UTC | |
by RonW (Parson) on Nov 07, 2014 at 23:54 UTC | |
|
Re: Help with Best Practices for Module Paths when scripting across multiple machines
by GotToBTru (Prior) on Nov 07, 2014 at 23:06 UTC | |
|
Re: Help with Best Practices for Module Paths when scripting across multiple machines
by Anonymous Monk on Nov 07, 2014 at 23:16 UTC |