I have to write scripts for a project. Since we have structured folders (in Linux environment) to be followed to put the scripts with respect to each modules which we create.
So, for example, I am working on Project XYZ and for this project I have to write my scripts (majority Perl) inside Module_XYZ
. Path to all(common) the modules is /home/shared/Mining/
.
My project module(Module_XYZ
) goes inside /home/shared/Mining/
. So I have to write scripts in /home/shared/Mining/Module_XYZ/
Since I have to use this path more often(in the script) instead of mentioning this path again and again I am storing in the script at the beginning in environment variable.
our %ENV;
if ( !defined( $ENV{'MOD_PATH'} ) ) {
$ENV{'MOD_PATH'} = "/home/shared/Mining/Module_XYZ/";
}
Is it a good idea to add this path in ENV
varaible and call $ENV{'MOD_PATH'}
whenever required,
or should I go with declaring it as constant like:
use constant MOD_PATH => "/home/shared/Mining/Module_XYZ/";
or simply go with
$MOD_PATH = "/home/shared/Mining/Module_XYZ/";
Need experts suggestions. TIA.