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 - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -