Hello - new subscriber here.
I've written a module which is essentially an application.
As such, it needs to install some config files, templates, and web
content. These need to have permissions and ownership set appropriately
for the host system (which might not be unix).
I'm pretty sure installing files to standard locations such as $etc,
$var, $usr_lib, and setting permissions are common things to want to do,
at least it's a common problem for me, but so far as I know none of the
CPAN frameworks (ExtUtils::MakeMaker, Module::Install, and what I'm
using currenly, Module::Build) seem to support that directly.
Naively you might think this should be as transparent as installing .pm
files. I'm sure it isn't, but I also wonder why there doesn't seem to
be many (any?) modules which try to tackle it, since it'd seem to be
such a common requirement.
So far I've seen the M::B::Cookbook, and looked at the Alien::Selenium
and OpenGuides distributions for examples of custom Module::Build
installations.
I also just recently discovered App::Build which looks promising as more
general solution. On closer inspection it seems to mandate the use of
App::Options over the usual Module::Build::ConfigData mechanism (which
it clobbers), and it doesn't do any automatic platform-specific path
configuration for you (which would be nice to have). Perhaps this would
be a good starting point, however.
Firstly, as presumably this wheel has been invented lots of times already:
- Are there any existing application installation frameworks exist
that I could use/build on (besides the ones above)?
- Are there any guidelines, or opinions about the various options I
could choose (such as App::Install)?
- Is there some reason why this niche hasn't already been filled by
Module::Build?
To elaborate, I'm looking for something which can not only define new
install directories for config, data, cgi scripts etc., but can infer
these appropriately for the platform in use, and set up permissions and
ownership too, where necessary. Perhaps that's asking for a lot.
My current solution is based on OpenGuides' installer - a subclass of
Module::Build which sets up new install directories with
M::B->install_path. After installing, my implementation sets the
correct file ownership and permissions of web content. It gets this
information from a file in the distribution called 'blib.perms' that
maps blib/ paths to symbolic permissions/ownership properties. To get
the paths it currently queries the user. Finally, it stores the paths
using Module::Build::ConfigData, so that the application can find the files.
It mostly works for me, but isn't especially well tested on platforms
besides Debian Linux (and even then, could probably do with more testing).
Some related questions I'd also like to ask:
- Are there any CPAN implementations of a function which works like
unix's 'cp -a', but cross platform? (File::Copy doesn't copy permissions
or ownership, and neither does ExtUtils::Install, at least on
directories. Therefore I've tried to implement one, it seems to work,
but see disclaimer above. )
- Likewise a directory generator which can assign the correct
permissions / ACLs or whatever? (Ditto last aside).
- If not, can anyone advice me where I might contribute most usefully?
Module::Build? App::Build?
Thanks,
Nick