Skip to content

Commit

Permalink
simplify bridge example in tutorial again
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 4, 2014
1 parent 016d38f commit 14bb818
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Mojolicious/Lite.pm
Expand Up @@ -535,12 +535,12 @@ routes are only evaluated if the callback returned a true value.
use Mojolicious::Lite;
# Authenticate based on name parameter
under {allow => 'Bender'} => sub {
under sub {
my $self = shift;
# Authenticated
my $name = $self->param('name') || '';
return 1 if $name eq $self->stash('allow');
return 1 if $name eq 'Bender';
# Not authenticated
$self->render('denied');
Expand All @@ -554,10 +554,10 @@ routes are only evaluated if the callback returned a true value.
__DATA__
@@ denied.html.ep
You are not <%= $allow %>, permission denied.
You are not Bender, permission denied.
@@ index.html.ep
Hi <%= $allow %>.
Hi Bender.
Prefixing multiple routes is another good use for L</"under">.
Expand Down

0 comments on commit 14bb818

Please sign in to comment.