friedo has asked for the wisdom of the Perl Monks concerning the following question:

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.

  1. 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.
  2. 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
  3. 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.
  4. 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?

  • Comment on Installation of various non-pm files with Module::Build

Replies are listed 'Best First'.
Re: Installation of various non-pm files with Module::Build
by GrandFather (Saint) on Aug 06, 2006 at 05:22 UTC
Re: Installation of various non-pm files with Module::Build
by adrianh (Chancellor) on Aug 06, 2006 at 09:19 UTC
    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
by diotalevi (Canon) on Aug 07, 2006 at 20:47 UTC

    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.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊