[Chicago-talk] Fw: Mason question
Andy_Bach at wiwb.uscourts.gov
Andy_Bach at wiwb.uscourts.gov
Wed Oct 6 15:07:40 CDT 2004
Isn't the meeting about Mason? Any guesses?
----- Forwarded by Andy Bach/WIWB/07/USCOURTS on 10/06/2004 03:07 PM -----
<barons at provide.net>
Sent by: perl-win32-users-bounces at listserv.ActiveState.com
10/06/2004 02:57 PM
To
<perl-win32-users at listserv.ActiveState.com>
cc
Subject
Mason question
I'm messing around with Mason and trying to get it to work
on Windoze, but seems not quite right. Has anyone had
success running this on w32? I set up my virtual root, and
the proper mappings to a .mason extension "just for
testing" and it will parse my html, but anything else won't
work. My example script below:
<html>
<title> Test Mason Page </title>
<head></head>
<body bgcolor="#ffffff">
<font face="Arial,Helvetica" size="4" color="#ff0000">
My test page <% 1900+(localtime)[5] %> 2 + 2 = <% 2 + 2 %>
</font>
</body>
</html>
I have my application mapping as:
C:\Perl\bin\Perl.exe c:\atm\cgi_handler.pl
And the example cgi_handler.pl is:
#!/usr/bin/perl
#
# This is a basic, fairly fuctional Mason handler.pl.
#
# For something a little more involved, check out
session_handler.pl
package HTML::Mason;
# Bring in main Mason package.
use HTML::Mason;
# Bring in ApacheHandler, necessary for mod_perl
integration.
# Uncomment the second line (and comment the first) to use
# Apache::Request instead of CGI.pm to parse arguments.
# use HTML::Mason::ApacheHandler;
# use HTML::Mason::ApacheHandler (args_method=>'mod_perl');
# Uncomment the next line if you plan to use the Mason
previewer.
#use HTML::Mason::Preview;
use strict;
# List of modules that you want to use from components (see
Admin
# manual for details)
#{ package HTML::Mason::Commands;
# use CGI;
#}
# Create Mason objects
#
my $parser = new HTML::Mason::Parser;
my $interp = new HTML::Mason::Interp (parser=>$parser,
comp_root=>'c:/atm',
data_dir=>'c:/atm-data');
use CGI;
my $q = new CGI;
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'};
$comp =~ s/\\/\//g;
my $root = $interp->comp_root;
$comp =~ s/^$root// or die "Component outside comp_root
$root";
print("Content-type: text/html\n\n");
$interp->exec($comp, %args);
I'm just trying to figure this out. Any help?
Thanks,
Allan
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users at listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
More information about the Chicago-talk
mailing list