Skip to content

Commit

Permalink
more diverse examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 21, 2016
1 parent 3ef203b commit 60dda3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -615,8 +615,8 @@ C<begin> and before C<end>.
% my $name = shift;
Hello <%= $name %>.
<% end %>
<%= $block->('Sebastian') %>
<%= $block->('Sara') %>
<%= $block->('Wolfgang') %>
<%= $block->('Baerbel') %>

A naive translation of the template to Perl code could look like this.

Expand All @@ -629,8 +629,8 @@ A naive translation of the template to Perl code could look like this.
$output .= '.';
return Mojo::ByteStream->new($output);
};
$output .= xml_escape scalar + $block->('Sebastian');
$output .= xml_escape scalar + $block->('Sara');
$output .= xml_escape scalar + $block->('Wolfgang');
$output .= xml_escape scalar + $block->('Baerbel');
return $output;

While template blocks cannot be shared between templates, they are most
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -19,17 +19,17 @@ Essentials every L<Mojolicious> developer should know.
The foundation of every web framework is a tiny black box connecting incoming
requests with code generating the appropriate response.

GET /user/show/1 -> $c->render(text => 'Sebastian');
GET /user/show/1 -> $c->render(text => 'Daniel');

This black box is usually called a dispatcher. There are many implementations
using different strategies to establish these connections, but pretty much all
are based around mapping the path part of the request URL to some kind of
response generator.

/user/show/2 -> $c->render(text => 'Daniel');
/user/show/2 -> $c->render(text => 'Isabell');
/user/show/3 -> $c->render(text => 'Sara');
/user/show/4 -> $c->render(text => 'Baerbel');
/user/show/5 -> $c->render(text => 'Wolfgang');
/user/show/4 -> $c->render(text => 'Stefan');
/user/show/5 -> $c->render(text => 'Fynn');

While it is very well possible to make all these connections static, it is also
rather inefficient. That's why regular expressions are commonly used to make
Expand Down

0 comments on commit 60dda3c

Please sign in to comment.