examples/plack.psgi

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 23 / 23 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Template/Stencil.pm ↑ Summary include/stencil_buf.h »
1 #!perl
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use File::Basename ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Template::Stencil;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # Runs under any PSGI server: plackup examples/plack.psgi
8 # (dirname(__FILE__) keeps template resolution independent of cwd).
9  
10 1 my $stencil = Template::Stencil->new(
11 template_dir => File::Basename::dirname(__FILE__) . '/templates',
12 wrapper => 'wrapper.tmpl',
13 stat_ttl => -1, # production: never re-stat cached templates
14 );
15  
16 2 ▶sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
17 2 my $env = shift;
18 my $body = $stencil->render('index', {
19 title => 'Stencil',
20 js_scripts => ['app.js'],
21 user => { name => 'lnation' },
22 2 items => [ map { { name => " item $_ " } } 1 .. 10 ],
23 });
24 2 [ 200,
25 [ 'Content-Type' => 'text/html; charset=utf-8',
26 'Content-Length' => length $body ],
27 [ $body ] ];
28 1 };
« blib/lib/Template/Stencil.pm ↑ Summary include/stencil_buf.h »