Installation of various non-pm files with Module::Build
I've got a CGI::Application-based web-app and I currently use Module::Build to install it. That works fine for the application code itself (the *.pm modules) but, with a web-app, there's always all sorts of other files: templates, a CSS file, a couple Javascript files, and the CGI script itself which instantiates the module.
These need to be installed in various directories; the CGI script in a CGI-executable directory, the JS and CSS files in another web directory (depending on the user's configuration), the template files somewhere else, etc. I've been pondering a few solutions to this, but I keep going around in circles.
- Just install everything in the same place the .pm files go, and write some runmodes to load and spit out the .css and .js files.
- Very easy and simple
- But very inefficient in a pure CGI environment
- Makes it hard for users to modify the templates or CSS.
- Override some method in Module::Build to prompt the user for their web, template and CGI directories, and install the stuff there.
- Slightly less easy and simple
- But it's much more efficient to have static files instead of file-spitting CGI code
- Relies on the user being less dumb
- Makes it easier for users to modify the templates and CSS
- Distribute the templates, CSS and JS separately from the modules.
- Allows the user to put the stuff wherever they want, independant of the module building process
- But the module distribution itself is non-functional without the other parts.
- There's also complete all-in-one systems like that used by Krang, but I think that's definitely overkill for my purposes.
Have any of you dealt with this issue before? How did you handle it?
Re: Installation of various non-pm files with Module::Build
If you super search for "Module::Build install files" in SOPW you will find, among many hits, node 345434 and node 320327 which may help.
DWIM is Perl's answer to Gödel
Re: Installation of various non-pm files with Module::Build
Override some method in Module::Build to prompt the user for their web, template and CGI directories, and install the stuff there
You don't have to override methods - there are built in mechanisms in Module::Build for handling this. Check out the section "Adding new elements to the install process" in Module::Build::Cookbook.
Re: Installation of various non-pm files with Module::Build
Look at DROLSKY's installers. He told me that he uses M::B as program installers for his Mason stuff which is all about css and other tag-along files.