How to open a file from a perl module -


i have module called conf.pm , opens file called conf.json. conf.json relative path conf.pm ".../conf/conf.json";

but when include conf.pm in scripts in other folders relative path changes , conf.pm not find conf.json.

how can open conf.json conf.pm.

the trick here use module findbin allows work 'relative location' in module.

in .pm add:

use findbin; $home_path = $findbin::realbin;  $json_path = $home_path."/../conf/conf.json"; 

Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -