me$ cat foo.tt
[% FILTER redirect("foo.html") %]
blah
[% END %]
me$ tpage foo.tt
redirect error - OUTPUT_PATH is not set
me$
Somebody submitted a very simple patch against tpage, which is one way to solve it. Another is to write a very short Perl script that uses the programmatic interface and use it to replace tpage. In case you can't or don't want to do either of those, though, here's a third, quick-and-dirty recipe which you can just cut and paste and still use with tpage:
me$ cat foo2.tt
[% PERL %]
$context->CONFIG->{OUTPUT_PATH} = ".";
[% END # perl %]
[% FILTER redirect("foo.html") %]
blah
[% END %]
me$ tpage --eval_perl foo.tt
me$ cat foo.html
blah
me$
if one is lazy (like me) then after the line 77 in tpage source:
ReplyDeleteunshift(@{ $ucttopts->{ INCLUDE_PATH } }, '.');
add the following:
# add default output path
if ( ! $ucttopts->{ OUTPUT_PATH } ) {
$ucttopts->{ OUTPUT_PATH }=".";
};
this will add the current directory as a default output path if its not been define via the command-line