#!/home/dawndanc/bin/speedy # # was !/home/dawndanc/bin/perl # was #!/usr/bin/perl ############################################## # This script invokes the dawndance web pages. # It works like this: # # (1) in httpd.conf # # DocumentRoot /home/dawndanc/html # # # (2) in /home/dawndanc/html/.htaccess # Action text/html /mason_handler.cgi # # (3) and this file is # /home/dawndanc/html/mason_handler.cgi # # (4) which is run via CGII::SpeedyCGI # which is installed here in /home/dawndance/2005 # (see /home/dawndance/2005/install), making # each .cgi invocation connect to a persistent # backend process. # # Based on http://www.masonhq.com/docs/manual/Interp.html, # with explicit $page and URL arguments passed # to mason's exec() . # # - Jim Mahoney, Feb 2002 # re-installed and updated Aug 2005 ########################################################## $ENV{PATH} = '/home/dawndanc/bin:' . $ENV{PATH}; use HTML::Mason; use CGI qw(Vars); #use vars qw( $outbuf $parser $comp_root $data_dir $interp ); my ($outbuf, $parser, $comp_root, $data_dir, $interp); $outbuf = ''; $comp_root = '/home/dawndanc/html' unless defined($comp_root); $data_dir = '/home/dawndanc/mason' unless defined($data_dir); # $parser = new HTML::Mason::Parser unless defined($parser); $interp = new HTML::Mason::Interp( # parser => $parser, comp_root => $comp_root, data_dir => $data_dir, out_method => \$outbuf, ) unless defined($interp); my $page = $ENV{PATH_INFO} || '/home.html'; if (0) { # ######## DEBUGGING ########## testing inputs: print "Content-type: text/plain\n\n"; print " page = $page \n ---------------------------- \n"; foreach my $key (keys %ENV) { print " \$ENV{ $key } = '" . $ENV{$key} . "'\n"; } my $cgi = new CGI; my @args = $cgi->Vars; print " ------------------------------------------ \n"; print " cgi->url(absolute) = $page \n"; print " Vars: \n"; foreach my $element (@args) { print " '$element' \n"; } print " interp = '$interp' \n"; print " ----- end debug ------------------------- \n\n"; # ################################################# } my $retval = eval{ $interp->exec( $page, Vars ) }; if ($@){ print "Content-type: text/plain\n\n"; print " -"x10, " HTML::Mason Error ", " -"x10,"\n"; #print " \@!='$!'.\n"; print " \$@='$@'.\n"; print " return value = '$retvalue'.\n"; print " -"x24,"\n"; } else { print "Content-type: text/html; charset=ISO-8859-1\n\n"; print $outbuf; }