Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Alias (5735)

  (email not shown publicly)

Journal of Alias (5735)

Tuesday January 09, 2007
12:43 AM

Dear Lazyweb: CGI applications as CPAN modules?

[ #32102 ]

Of late, I've been trying to convert all my code into CPAN distribution, even the stuff that isn't normally done that way.

So far modules, console applications and gui applications mostly work ok, and the new File::HomeDir and File::ShareDir help solve the user resource and read-only data problems.

The next problem for me is CGI applications.

They almost certainly should be buildable as CPAN dists, but we have the problem of the public_html directory.

How do I deal with this? And can one install the CGI without necesarily doing so as root? Do we assume a private Perl? Private lib directory? Do I install public_html via File::ShareDir and then provide a utility to copy it to some target directory?

Other than "I do it by hand", how do you currently solve automated CGI setup? Or how do think it might be done?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I don't think this will work out well with the tools we have.

    Let me explain: The default installation paths for the traditional Perl resources are taken from the compile-time %Config hash. This includes various paths for modules and their binary parts, but no concept of user directories, /var/www or any other resources.

    Naturally, %Config being populated on perl-compile time cannot and should not provide this information. But scanning the system File::HomeDir-esque during installation and making guesses on b
    • Worse yet is asking the user during installation of a CPAN module. These kinds of questions are what makes the lives of sysadmins and cpan testers alike miserable.

      What you need is the installation of some tool in the bindir which can complete the installation. Taking the same approach that e.g. kwiki or rails takes. It does involve packaging all the assets into a Perl module somehow and then extracting them. In fact, a framework that does this might well be a useful CPAN module...


    • There are at least a few methods for leveraging "their binary parts".

      File::ShareDir is built entirely on it. It installs files into the /auto/ lib area.

      While I agree that teaching the CPAN infrastructure about the other resource types is likely to be impossible, I'm not entirely sure that asking the user is necesarily a bad idea.

      We already let users override the installation paths via things like PREFIX. So in principle the concept of user-driven configuration is not necesarily a bad idea, particularly on s
  • What I normally do in this case, is make sure I can set up a web application using a single script. This script involves a relatively simple call to the constructor of the main module (inherited from CGI::Application or whatever) with some params, and then calling its run() method (and exiting). Then I put an Apache alias to the script to serve it under a certain location.

    The application is self-contained and is aware of everything it needs, and is entirely hosted on the URL that it was placed on. This