#!psgi -w use strict; use Text::Xslate; use Plack::Request; my %vpath = ( 'hello.tx' => <<'TX', hello

Hello, <: $lang :> world!

TX ); my $tx = Text::Xslate->new( path => \%vpath, cache_dir => '.eg_cache', ); sub app { my($env) = @_; my $req = Plack::Request->new($env); my $res = $req->new_response( 200, [content_type => 'text/html; charset=utf-8'], ); my %vars = ( lang => $req->param('lang') || '', ); my $body = $tx->render('hello.tx', \%vars); utf8::encode($body); $res->body($body); return $res->finalize(); } return \&app;