Skip to content

Commit

Permalink
a few more documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 29, 2012
1 parent c44c2ba commit a3bb5e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/Mojolicious/Guides/Growing.pod
Expand Up @@ -502,12 +502,14 @@ actual action code needs to be changed.

sub startup {
my $self = shift;
my $r = $self->routes;

$self->secret('Mojolicious rocks');
my $users = MyUsers->new;
$self->helper(users => sub { return $users });

# Routes
my $r = $self->routes;

$r->any('/' => sub {
my $self = shift;

Expand Down Expand Up @@ -610,12 +612,12 @@ information.

sub startup {
my $self = shift;
my $r = $self->routes;

$self->secret('Mojolicious rocks');
my $users = MyUsers->new;
$self->helper(users => sub { return $users });

my $r = $self->routes;
$r->any('/')->to('login#index')->name('index');
$r->get('/protected')->to('login#protected')->name('protected');
$r->get('/logout')->to('login#logout')->name('logout');
Expand Down
16 changes: 11 additions & 5 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -150,7 +150,7 @@ routes structures.
sub startup {
my $self = shift;

# Router
# Routes
my $r = $self->routes;

# Route
Expand Down Expand Up @@ -257,7 +257,9 @@ sensitive.

sub startup {
my $self = shift;
my $r = $self->routes;

# Routes
my $r = $self->routes;

# /bye -> {controller => 'foo', action => 'bye'} -> MyApp::Foo->bye
$r->route('/bye')->to(controller => 'foo', action => 'bye');
Expand Down Expand Up @@ -524,7 +526,6 @@ which makes them a very powerful tool especially for plugins.

sub startup {
my $self = shift;
my $r = $self->routes;

# Check all requests for a "/test" prefix
$self->hook(before_dispatch => sub {
Expand All @@ -533,7 +534,10 @@ which makes them a very powerful tool especially for plugins.
if $self->req->url->path->contains('/test');
});

# Routes that will not be reached if the hook above renders a response
# Routes
my $r = $self->routes;

# These will not be reached if the hook above renders a response
$r->route('/welcome')->to('foo#welcome');
$r->route('/bye')->to('foo#bye');
}
Expand Down Expand Up @@ -716,11 +720,13 @@ applications.

sub startup {
my $self = shift;
my $r = $self->routes;

# Plugin
$self->plugin('WerewolfCondition');

# Routes
my $r = $self->routes;

# /hideout (keep them out for 4 days after full moon)
$r->route('/hideout')->over(werewolf => 4)
->to(controller => 'foo', action => 'bar');
Expand Down

0 comments on commit a3bb5e1

Please sign in to comment.