NAME
Template::Stencil::PSGI - tiny PSGI conveniences for Template::Stencil
SYNOPSIS
use Template::Stencil::PSGI;
my $view = Template::Stencil::PSGI->new(
template_dir => 'templates',
wrapper => 'wrapper.tmpl',
);
# a finished PSGI response tuple
my $res = $view->res('index', { title => 'Hi' });
# or a tiny routed app
my $app = $view->to_app({
'/' => [ 'index', sub { my $env = shift; { title => 'Hi' } } ],
'/about' => 'about',
});
METHODS
new
Takes exactly the Template::Stencil constructor options.
stencil
The underlying Template::Stencil object.
res($template, \%data, $status, \@headers)
Render and return a PSGI response tuple. Status defaults to 200; extra headers are appended after Content-Type and Content-Length.
to_app(\%routes)
Returns a PSGI app. A route value is either a template name or [$template, \%data | sub ($env) { ... } ]. Unknown paths get a 404.
AUTHOR
LNATION <email@lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION <email@lnation.org>. This is free software, licensed under The Artistic License 2.0.