| 1 | package Thunderhorse::Module::Template; | ||
| 2 | 4 | $Thunderhorse::Module::Template::VERSION = '0.107'; | |
| 3 | 4 | ▶ | use v5.40; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use Mooish::Base -standard; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 4 | ▶ | use Gears::X::Thunderhorse; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 4 | ▶ | use Gears::Template::TT; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 4 | extends 'Thunderhorse::Module'; | |
| 10 | |||
| 11 | 4 | has field 'template' => ( | |
| 12 | isa => InstanceOf ['Gears::Template'], | ||
| 13 | lazy => 1, | ||
| 14 | ); | ||
| 15 | |||
| 16 | 4 | ▶ | sub _build_template ($self) |
|
Subroutine
_build_template: called CC=1 SCAR=0.0
| |||
| 17 | { | ||
| 18 | 4 | my $config = $self->config; | |
| 19 | |||
| 20 | 4 | return Gears::Template::TT->new($config->%*); | |
| 21 | } | ||
| 22 | |||
| 23 | 4 | ▶ | sub build ($self) |
|
Subroutine
build: called CC=1 SCAR=0.0
Pod
documented
| |||
| 24 | { | ||
| 25 | 4 | weaken $self; | |
| 26 | 4 | my $tpl = $self->template; | |
| 27 | |||
| 28 | 7 | $self->add_method( | |
| 29 | 7 | ▶ | controller => template => sub ($controller, $template, $vars = {}) { |
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||
| 30 | 7 | return $tpl->process($template, $vars); | |
| 31 | } | ||
| 32 | 4 | ); | |
| 33 | } | ||
| 34 | |||
| 35 | __END__ | ||