perltidy
This commit is contained in:
+17
-16
@@ -5,11 +5,9 @@ use strict;
|
|||||||
use base 'Mojo::Base';
|
use base 'Mojo::Base';
|
||||||
|
|
||||||
use Template ();
|
use Template ();
|
||||||
use Carp ();
|
use Carp ();
|
||||||
|
|
||||||
__PACKAGE__->attr('tt',
|
__PACKAGE__->attr('tt', chained => 1,);
|
||||||
chained => 1,
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@@ -28,7 +26,7 @@ sub _init {
|
|||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# take and process options :-)
|
# take and process options :-)
|
||||||
|
|
||||||
my %config = (
|
my %config = (
|
||||||
COMPILE_EXT => '.ttc',
|
COMPILE_EXT => '.ttc',
|
||||||
COMPILE_DIR => ($dir || "/tmp"),
|
COMPILE_DIR => ($dir || "/tmp"),
|
||||||
@@ -39,7 +37,7 @@ sub _init {
|
|||||||
ABSOLUTE => 1,
|
ABSOLUTE => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
$self->tt(Template->new( \%config ))
|
$self->tt(Template->new(\%config))
|
||||||
or Carp::croak "Could not initialize Template object: $Template::ERROR";
|
or Carp::croak "Could not initialize Template object: $Template::ERROR";
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@@ -52,16 +50,19 @@ sub _render {
|
|||||||
#warn dump(\@args);
|
#warn dump(\@args);
|
||||||
|
|
||||||
my $output;
|
my $output;
|
||||||
unless ( $self->tt->process( $path,
|
unless (
|
||||||
{ c => $c,
|
$self->tt->process(
|
||||||
tx => $tx,
|
$path,
|
||||||
},
|
{ c => $c,
|
||||||
\$output,
|
tx => $tx,
|
||||||
{ binmode => ":utf8" }
|
},
|
||||||
)
|
\$output,
|
||||||
) {
|
{binmode => ":utf8"}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
Carp::carp $self->tt->error . "\n";
|
Carp::carp $self->tt->error . "\n";
|
||||||
return $self->tt->error;
|
return $self->tt->error;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $output;
|
return $output;
|
||||||
@@ -154,4 +155,4 @@ under the same terms as Perl itself.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
1; # End of MojoX::Renderer::TT
|
1; # End of MojoX::Renderer::TT
|
||||||
|
|||||||
Reference in New Issue
Block a user