Skip to content

Commit

Permalink
use a little less code for deprecated helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 19, 2015
1 parent 1acafea commit 46e3754
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions lib/Mojolicious/Plugin/DefaultHelpers.pm
Expand Up @@ -11,8 +11,8 @@ sub register {
my ($self, $app) = @_;

# DEPRECATED in Tiger Face!
$app->helper(render_exception => \&_render_exception);
$app->helper(render_not_found => \&_render_not_found);
$app->helper(render_exception => sub { _render('exception', @_) });
$app->helper(render_not_found => sub { _render('not_found', @_) });

# Controller alias helpers
for my $name (qw(app flash param stash session url_for validation)) {
Expand Down Expand Up @@ -150,17 +150,11 @@ sub _is_fresh {
}

# DEPRECATED in Tiger Face!
sub _render_exception {
deprecated 'Mojolicious::Controller::render_exception is DEPRECATED in'
. ' favor of the reply->exception helper';
shift->helpers->reply->exception(@_);
}

# DEPRECATED in Tiger Face!
sub _render_not_found {
deprecated 'Mojolicious::Controller::render_not_found is DEPRECATED in'
. ' favor of the reply->not_found helper';
shift->helpers->reply->not_found;
sub _render {
my $page = shift;
deprecated "Mojolicious::Controller::render_$page is DEPRECATED in favor of"
. " the reply->$page helper";
shift->helpers->reply->$page(@_);
}

sub _static {
Expand Down

0 comments on commit 46e3754

Please sign in to comment.