|
Revision 10530, 490 bytes
(checked in by tokuhirom, 5 years ago)
|
|
Moose based web application framework.
|
| Line | |
|---|
| 1 | package Nanto::View::TT; |
|---|
| 2 | use Moose; |
|---|
| 3 | use String::CamelCase qw/decamelize/; |
|---|
| 4 | use Template; |
|---|
| 5 | use Carp; |
|---|
| 6 | |
|---|
| 7 | with 'Nanto::Role::View'; |
|---|
| 8 | |
|---|
| 9 | has tt_instance => ( |
|---|
| 10 | is => 'rw', |
|---|
| 11 | isa => 'Template', |
|---|
| 12 | default => sub { Template->new }, |
|---|
| 13 | ); |
|---|
| 14 | |
|---|
| 15 | has tmpl_fname => ( |
|---|
| 16 | is => 'rw', |
|---|
| 17 | isa => 'Str', |
|---|
| 18 | default => '', |
|---|
| 19 | ); |
|---|
| 20 | |
|---|
| 21 | sub output { |
|---|
| 22 | my ($self, ) = @_; |
|---|
| 23 | |
|---|
| 24 | $self->tt_instance->process( $self->tmpl_fname, $self->params, \my $out ) or croak $self->tt_instance->error; |
|---|
| 25 | $out; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | 1; |
|---|