Terrence Brannon
2005-09-16 11:27:08 UTC
I'm happy to say that HTML::Mason has been completely removed from my
personal website:
http://www.livingcosmos.org/
It was fairly easy to write a subclass of CGIP whose render phase took
an HTML file and templated it. I just needed a RewriteRule to push all
html files to the CGIP subclass:
RewriteRule ^/(.+)[.]s?html$ /cgi-bin/lc.cgi/$1.html [PT]
and then I used PATH_TRANSLATED to serve the HTML file:
sub dispatch {
my $self = shift;
my $p = $ENV{PATH_TRANSLATED};
$p =~ s!cgi-bin.+lc.cgi/!!;
$self->reflect->addSlot(file_path => $p);
$self->pkg_for_path($p) ;
}
sub pkg_for_path {
my ($self, $path) = @_;
my $M = Tie::RegexpHash->new;
$M->add( qr,vots/index.html, => 'App::vots' ) ;
if (my $new_page = $M->match($path)) {
eval "require $new_page";
die $@ if $@;
warn 'NP', $new_page;
$new_page;
} else {
return $self;
}
}
personal website:
http://www.livingcosmos.org/
It was fairly easy to write a subclass of CGIP whose render phase took
an HTML file and templated it. I just needed a RewriteRule to push all
html files to the CGIP subclass:
RewriteRule ^/(.+)[.]s?html$ /cgi-bin/lc.cgi/$1.html [PT]
and then I used PATH_TRANSLATED to serve the HTML file:
sub dispatch {
my $self = shift;
my $p = $ENV{PATH_TRANSLATED};
$p =~ s!cgi-bin.+lc.cgi/!!;
$self->reflect->addSlot(file_path => $p);
$self->pkg_for_path($p) ;
}
sub pkg_for_path {
my ($self, $path) = @_;
my $M = Tie::RegexpHash->new;
$M->add( qr,vots/index.html, => 'App::vots' ) ;
if (my $new_page = $M->match($path)) {
eval "require $new_page";
die $@ if $@;
warn 'NP', $new_page;
$new_page;
} else {
return $self;
}
}
--
Carter's Compass: I know I'm on the right track when,
by deleting something, I'm adding functionality.
Carter's Compass: I know I'm on the right track when,
by deleting something, I'm adding functionality.