Options:
- Search in the current directory for appname.conf / appname.ini or the like
- Search in the directory containing the main script (i.e. dirname($0).'/appname.conf')
- Place all your executable scripts in somewhere/bin, place the configuration files in somewhere/etc, and place your own modules in somewhere/lib. Use C<$FindBin::Bin> to locate your executable, take its dirname(), replace '/bin' with '/etc/appname.ini'.
- Require that an environment variable is set up to point to your configuration file. Refuse to work unless it is set.
- Pass the name of the configuration file as command line argument (does not work in web environment).
- Search in the "usual" places: /etc/appname.conf or /etc/appname/setup.conf, and $HOME/.appname or $HOME/.appname/setup.conf on Unix-like systems, H:\Documents and Settings\Joe User\Application Data\AppName on Windows. Don't hardcode the path names on Windows, they keep changing from translation to translation and from version to version. Use Win32::GetFolderPath(CSIDL_xxx).
Note that forward slashes work both on Unix-like systems AND on Windows. Only some stupid Windows command line utilities can't handle file names with forward slashes. Even ancient DOS versions DO support forward slashes in path names at the API level (i.e. INT 0x21), only the applications refused to pass forward slashes to the API.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)