Apr 2, 2009, 12:51 AM
Post #1 of 3
Dear Perl guru,
module specific property file
I have a Perl module that relies on a specific property file to initialize. The thing that has been bothering me is what the best practice is to put such property file. The option that I prefer is to put the property file in the same folder of the Perl module for easy packaging, but I don't know how to make the module locate the path of itself to read the property file. It's easy to get the current working path of the main program, but not trivial to get the path of an individual module in the main program. One could use the PERL5LIB environmental variable to scan and locate the path of the target module, but what if the module was called using the "use lib" style by the main program? Another option that I can think of is to use the __DATA__ virtual file to physically append the property file at the end of the Perl module. But, I am not sure whether it's the best practice and whether there is any better choice. I'd appreciate if you give me any advice. Thanks!
(This post was edited by handreach on Apr 2, 2009, 12:54 AM)