Skip to content

Commit

Permalink
no need for closures
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 28, 2016
1 parent 59d96c3 commit c64d4cc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -13,13 +13,7 @@ has classes => sub { ['main'] };
has default_format => 'html';
has 'default_handler';
has encoding => 'UTF-8';
has handlers => sub {
{
data => sub { ${$_[2]} = $_[3]{data} },
text => sub { ${$_[2]} = $_[3]{text} },
json => sub { ${$_[2]} = encode_json($_[3]{json}) }
};
};
has handlers => sub { {data => \&_data, json => \&_json, text => \&_text} };
has helpers => sub { {} };
has paths => sub { [] };

Expand Down Expand Up @@ -221,6 +215,10 @@ sub warmup {
}
}

sub _data { ${$_[2]} = $_[3]{data} }

sub _json { ${$_[2]} = encode_json($_[3]{json}) }

sub _next {
my $stash = shift;
return delete $stash->{extends} if $stash->{extends};
Expand All @@ -240,6 +238,8 @@ sub _render_template {
return 1 if defined $$output;
}

sub _text { ${$_[2]} = $_[3]{text} }

1;

=encoding utf8
Expand Down

0 comments on commit c64d4cc

Please sign in to comment.