Anyone using Mason for standalone scripts
am 15.01.2008 20:25:43 von SteveI'm playing around with Mason as a template-parser for standalone
scripts outside of a web environment. If it works well enough, I might
apply the approach toward writing a Mason wrapper so I can use Mason in
shared-hosting environments where I don't have access to Apache httpd.conf.
Anyway, I'm following the example provided in Mason's admin guide, and
have a small standalone script like this:
#!c:/Perl/bin/perl.exe
use HTML::Mason;
use strict;
my $outbuf;
my $interp = HTML::Mason::Interp->new(
comp_root => 'c:/workspace/MyMasonTemplates',
data_dir => 'c:/workspace/MyMasonData',
out_method => \$outbuf
);
$interp->exec( 'test.html' );
However, when I run this script I get the following error:
Component path given to Interp->load must be absolute (was given test.html)
I'm using a relative path in the example above because that's what the
Mason admin manual calls for (that's the whole point of specifying a
"comp_root" value). However, the interesting thing is that the error
message is exactly the same even when I change the parameter to
$interp->exect() to be the absolute path of this filename. Can anyone
who's used Mason in a standalone script environment spot what I might be
missing here?