Subject: | TEXINPUTS set incorrectly when used with Catalyst::View::TT or any coderef in INCLUDE_PATH |
Template::Provider (the default template provider for TT) supports dynamic INCLUDE_PATH values by pushing coderefs into INCLUDE_PATH. At template lookup time, it calls any coderefs it comes across.
Catalyst::View::TT makes use of this feature to support locally-overridden INCLUDE_PATHs.
When I create a Latex view for a Catalyst app using Catalyst::View::TT and passing CLASS => 'Template::Latex' in the configuration hash, the TEXINPUTS variable isn't set correctly in Template::Plugin::Latex because the coderef gets stringified. The end result of all this is that \input{} doesn't work with paths relative to the template file itself.
A workaround is to use TT's INCLUDE directive instead, although that does end up parsing the included file as a template instead of slurping it in as raw TeX.
A quick fix for Template::Plugin::Latex is to handle coderefs in INCLUDE_PATH inside _setup_texinput_paths. However, I suspect there is a better API for this that the Template $context object provides in order to hide the implementation details of INCLUDE_PATH from plugins like Latex.