I have written a suit of 18 programs in Perl to process data in a folder called 'project/data'. During the development I realized that for each stage of the downstream analysis I'd better have intermediate data distributed into other folders for convenience within the same parent directory 'project', so I created folders such as 'project/test', 'project/regions' and 'project/report', data is sequentially processed in 'test' then in 'regions' then in 'report'.

Now, inside each one of those there is a Perl program that does something or the other with the data. For the sake of trace-ability I moved the programs into one location, 'project/PerlCode'. When these programs were written I have worked with absolute paths so I go passing the entire path qualifier for a program that reads or writes right from 'root' all the way to 'project' all the way to that specific folder where the program does its work.

Apparently, not the nicest of designs to be adopted, for better portability I will like to have this suite of programs create the downstream folders automatically and cohesively, easily done, but above all, the biggest/difficult part is, I want these programs to be oblivious to the directory structure and be contained in their own 'project' folder that regardless of which machine they run on they will just perform out of the box. Maybe this requirement is strongly suggestive of a modification from an absolute path dichotomy to a relative path one.

A potential candidate I have on the table is FindBin, yet it has issues that do with competitive calling (portentially solvable according to the docs). Another approach is to have a that calls each of these programs from 'PerlCode' folder, yet, each one of these programs should know which folder it gotta write or read into, how do I achieve this and avoid explicit calling of the entire path and make these programs aware of their immediate surrounding structures regardless of where in the directory tree the folder 'project' is placed ?.

Any tips, suggestions, alternative approaches and quick-fixes thereof are heartily welcome.

David R. Gergen said "We know that second terms have historically been marred by hubris and by scandal." and I am a two y.o. monk today :D, June,12th, 2011...