http://www.perlmonks.org?node_id=649249

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

I searched CPAN, but am not certain what sort of search terms to use, so hopefully someone here has an answer:

I'm looking for a module/tool to bundle up the various resources for a web app (images, javascript, css, static HTML, etc. files) so they can be installed/used as general Perl modules. I've done this "by hand" in the past by just MIME64'ing image files and embedding them into heredocs or DATA sections with accessor functions, but thought there might be a better packaged solution ?

Specifically, I'd like to be able to specify certain file qualifiers as text to be minified, others to be embedded as is, and others to be MIME64'd, then point the tool at a directory tree and let it suck in everything, generating appropriate wrappers as needed.

Any pointers much appreciated.


Perl Contrarian & SQL fanboy

Replies are listed 'Best First'.
Re: Web App Resource/Asset Bundler ?
by perrin (Chancellor) on Nov 06, 2007 at 17:37 UTC
    Usually people use a tarball for this, with the perl code and other stuff in it. What problem are you trying to solve by putting the data into your module instead?
      I'm trying to simplify deployment for standalone web apps, ie, browser based GUI apps. Instead of running under Apache or somesuch, a web app would include its own web server module (eg, HTTP::Server::Simple, HTTP::Daemon, HTTP::Daemon::Threaded, etc.). Assuming the app might eventually be packaged into an exe (via PAR, perl2exe, etc.), or even installed as a std. Perl package, it would be nice to have all the assets handled in the "Perlish" way, wo/ the hassle of trying to figure out the directory structure where the assets reside.

      So if the assets are all rolled into Perl modules, the app can just introspect to get datetime info, and roll HTTP headers as appropriate, doing any decoding/decompressing as needed.


      Perl Contrarian & SQL fanboy
        I think it would be a lot easier to package the whole thing as a tarball or other installer package and use relative paths in your scripts.
Re: Web App Resource/Asset Bundler ?
by fenLisesi (Priest) on Nov 07, 2007 at 09:32 UTC
    Two ideas:

    1. File::ShareDir
    2. Wrap up the entire system, OS and everything, into one vmware image and distribute that. Set up your Apache, arrange your file system to your heart's content.

    Cheers