Skip to content

Commit

Permalink
better synopsis examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 31, 2012
1 parent 222871e commit 37a8d23
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Reactor/Poll.pm
Expand Up @@ -27,7 +27,7 @@ sub one_tick {
$self->{running} = 1;

# Wait for one event
my $i = 0;
my $i;
my $poll = $self->_poll;
until ($i) {

Expand Down
10 changes: 4 additions & 6 deletions lib/Mojolicious.pm
Expand Up @@ -148,10 +148,8 @@ sub handler {
weaken $c->{tx};

# Dispatcher
unless ($self->{dispatch}) {
$self->hook(around_dispatch => \&_dispatch);
$self->{dispatch}++;
}
++$self->{dispatch} and $self->hook(around_dispatch => \&_dispatch)
unless $self->{dispatch};

# Process
unless (eval { $self->plugins->emit_chain(around_dispatch => $c) }) {
Expand All @@ -170,7 +168,7 @@ sub helper {
my $r = $self->renderer;
$self->log->debug(qq{Helper "$name" already exists, replacing.})
if exists $r->helpers->{$name};
$r->add_helper($name, @_);
$r->add_helper($name => @_);
}

# "He knows when you are sleeping.
Expand Down Expand Up @@ -228,7 +226,7 @@ Mojolicious - Real-time web framework
# Action
sub hello {
my $self = shift;
$self->render_text('Hello World!');
$self->render(text => 'Hello World!');
}
=head1 DESCRIPTION
Expand Down
1 change: 1 addition & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -545,6 +545,7 @@ Mojolicious::Controller - Controller base class
sub bar {
my $self = shift;
my $name = $self->param('name');
$self->res->headers->cache_control('max-age=1, no-cache');
$self->render(json => {hello => $name});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -26,8 +26,8 @@ my %TEMPLATES = map { $_ => $HOME->slurp_rel_file($_) } @{$HOME->list_files};
# In my day Xmas was about bringing people together,
# not blowing them apart."
sub new {
shift->SUPER::new(@_)->add_handler(data => \&_data)
->add_handler(json => \&_json)->add_handler(text => \&_text);
my $self = shift->SUPER::new(@_)->add_handler(json => \&_json);
return $self->add_handler(data => \&_data)->add_handler(text => \&_text);
}

sub add_handler {
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Routes.pm
Expand Up @@ -219,7 +219,7 @@ sub _walk {

=head1 NAME
Mojolicious::Routes - Always find your destination with routes
Mojolicious::Routes - Always find your destination with routes!
=head1 SYNOPSIS
Expand Down

0 comments on commit 37a8d23

Please sign in to comment.