How to store data for a perl module

Joshua Goodall joshua at
Sun Feb 24 04:05:01 CST 2002

On Sun, Feb 24, 2002 at 10:35:58AM +1100, Scott Penrose wrote:
> Where should I put it in the file system so that my perl module can find 
> it. Remember that perl modules can be installed in multiple operating 
> systems including Windows and Mac so putting it in /var/X, or /usr/lib/X 
> or /etc/X is not a good idea necessarily.
> Is there no answer to this, damn it ?

Sure there is, but it's not absolute: put it where the installation
platform's *sysadmin* would expect to find it, and make it simple
for a packager to vary it. Under a *nix, that usually means a choice
between /var, /usr/local/lib and /etc (implying it gets changed by
normal runtime, by installation, or by configuration, respectively).

Some Unices vary widely; e.g. debian users might want /usr/lib,
but under FreeBSD you'd be in /usr/local/libdata; Solaris admins
might expect /opt.  You'll end up suggesting defaults in Makefile.PL;
then when the module is packaged for target OS's by package
maintainers, they can override your defaults.

Under java, which is effectively a platform in itself, this rule
means putting it in the jarfile and specifying that it should be
reachable via the classloader, or a similar abstraction thereof.

These conventions will please the administrator/installer of your
code and avoid violating POLA.


More information about the Melbourne-pm mailing list