[rt-commit] CVS commit: rt

jesse at fsck.com jesse at fsck.com
Mon Apr 3 01:26:35 EDT 2000


Module Name:	rt
Committed By:	jesse
Date:		Mon Apr  3 05:26:35 UTC 2000

Modified Files:
	rt: Makefile
	rt/bin: rtmux.pl

Log Message:
Ok, I've modified rtmux.pl and Makefile to add in the first bits of stub
code for running Mason as a cgi. it compiles and appears to invoke.
but I haven't tested it under a webserver. I've gotta get to sleep now, but
figured this would give tobias a leg up with his testing today.

Subject:      RE: [Mason] Mason under CGI (was: replacing storyserver)
Author:       Ilmari Karonen <iltzu at sci.fi>
Date:         Fri, 17 Sep 1999 15:10:20 +0300 (EET DST)

On Thu, 16 Sep 1999, Ben Munoz wrote:
> I'm running Apache 1.3.6 on NT.  I'm looking to install HTML::Mason and see
> what it can do, but from what I've read, I can't install mod_perl with the
> current version of ActiveState's Perl, which I have installed on my machine.

I realize this is probably not what you were asking for, but I'd like to
mention here my recent (yesterday) experience in setting up Mason under
plain ol' CGI.

Setting: One Mason top level component plus a few subcomponents on a
development server with mod_perl and Mason. One production server with the
least possible selection of modules. (Not even mod_so!)

Needed to quickly get the Mason component up and running on the second
server. Installing Mason itself and a few other perl modules was easy.
But adding mod_perl was definitely out of the question.

What I did was take the usual handler.pl, copy it to cgi-bin, deleting
everything from "my $ah = new HTML::Mason::ApacheHandler" onward
inclusive, and replacing it with the following:

    use CGI;
    my $q = new CGI;

    # This routine comes from ApacheHandler.pm:
    my (%args);
    foreach my $key ( $q->param ) {
      foreach my $value ( $q->param($key) ) {
        if (exists($args{$key})) {
          if (ref($args{$key})) {
            $args{$key} = [@{$args{$key}}, $value];
          } else {
            $args{$key} = [$args{$key}, $value];
          }
        } else {
          $args{$key} = $value;
        }
    }

    my $comp = $ENV{'PATH_TRANSLATED'};
    my $root = $interp->comp_root;
    $comp ~= s/^$root//  or die "Component outside comp_root";

    $interp->exec($comp, %args);

This, plus an Action line in httpd.conf mapping *.mas to this script, has
so far done the job just fine.

One problem I noticed was that this all would've been much harder if I
hadn't been familiar with the way ApacheHandler.pm uses CGI.pm and hadn't
known where to find that parsing routine. IMHO it'd be a good idea to
separate this loop into a user-callable subroutine.

(Note: this was Mason 0.6.mumble - I have no experience with the newer
versions.)

--
Ilmari Karonen (iltzu at sci.fi)
http://www.sci.fi/~iltzu/

_______________________________________________
Mason maillist  -  Mason at netizen.com.au
http://netizen.com.au/mailman/listinfo/mason


To generate a diff of this commit:
cvs rdiff -r1.90.2.61 -r1.90.2.62 rt/Makefile
cvs rdiff -r1.15.2.14 -r1.15.2.15 rt/bin/rtmux.pl






More information about the Rt-commit mailing list