Skip to content

Commit

Permalink
remove auto_render method from Mojolicious::Routes
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 24, 2015
1 parent b3308b1 commit d3cbf13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -12,6 +12,7 @@
- Removed multi-name support from param method in Mojo::Parameters.
- Removed multi-name support from cookie and upload methods in
Mojo::Message.
- Removed auto_render method from Mojolicious::Routes.
- Removed deprecated object-oriented Mojo::Loader API.
- Removed deprecated accept_interval, lock and unlock attributes from
Mojo::IOLoop.
Expand Down
22 changes: 8 additions & 14 deletions lib/Mojolicious/Routes.pm
Expand Up @@ -17,20 +17,13 @@ has namespaces => sub { [] };
sub add_condition { $_[0]->conditions->{$_[1]} = $_[2] and return $_[0] }
sub add_shortcut { $_[0]->shortcuts->{$_[1]} = $_[2] and return $_[0] }

sub auto_render {
my ($self, $c) = @_;
my $stash = $c->stash;
return if $stash->{'mojo.rendered'};
$c->render_maybe or $stash->{'mojo.routed'} or $c->helpers->reply->not_found;
}

sub continue {
my ($self, $c) = @_;

my $match = $c->match;
my $stack = $match->stack;
my $current = $match->current;
return $self->auto_render($c) unless my $field = $stack->[$current];
return $self->_render($c) unless my $field = $stack->[$current];

# Merge captures into stash
my $stash = $c->stash;
Expand Down Expand Up @@ -199,6 +192,13 @@ sub _load {
return $self->{loaded}{$app} = 1;
}

sub _render {
my ($self, $c) = @_;
my $stash = $c->stash;
return if $stash->{'mojo.rendered'};
$c->render_maybe or $stash->{'mojo.routed'} or $c->helpers->reply->not_found;
}

1;

=encoding utf8
Expand Down Expand Up @@ -296,12 +296,6 @@ Add a new condition.
Add a new shortcut.
=head2 auto_render
$r->auto_render(Mojolicious::Controller->new);
Automatic rendering.
=head2 continue
$r->continue(Mojolicious::Controller->new);
Expand Down

0 comments on commit d3cbf13

Please sign in to comment.