Permalink
Browse files

better hook description

  • Loading branch information...
1 parent 9d1ef44 commit 4186f5e7a059aaacdd9533170cce61a6cfcc08ff @kraih committed Aug 2, 2012
Showing with 18 additions and 17 deletions.
  1. +12 −12 lib/Mojo/Content.pm
  2. +2 −1 lib/Mojolicious.pm
  3. +4 −4 lib/Mojolicious/Lite.pm
View
@@ -351,32 +351,32 @@ RFC 2616.
L<Mojo::Content> can emit the following events.
-=head2 C<drain>
+=head2 C<body>
- $content->on(drain => sub {
- my ($content, $offset) = @_;
+ $content->on(body => sub {
+ my $content = shift;
...
});
-Emitted once all data has been written.
+Emitted once all headers have been parsed and the body starts.
- $content->on(drain => sub {
+ $content->on(body => sub {
my $content = shift;
- $content->write_chunk(time);
+ $content->auto_upgrade(0) if $content->headers->header('X-No-MultiPart');
});
-=head2 C<body>
+=head2 C<drain>
- $content->on(body => sub {
- my $content = shift;
+ $content->on(drain => sub {
+ my ($content, $offset) = @_;
...
});
-Emitted once all headers have been parsed and the body starts.
+Emitted once all data has been written.
- $content->on(body => sub {
+ $content->on(drain => sub {
my $content = shift;
- $content->auto_upgrade(0) if $content->headers->header('X-No-MultiPart');
+ $content->write_chunk(time);
});
=head2 C<read>
View
@@ -438,7 +438,8 @@ and the application object, as well as a function in C<ep> templates.
$app->hook(after_dispatch => sub {...});
-Extend L<Mojolicious> with hooks.
+Extend L<Mojolicious> with hooks, which allow code to be shared with all
+requests indiscriminately.
# Dispatchers will not run if there's already a response code defined
$app->hook(before_dispatch => sub {
@@ -967,13 +967,13 @@ Start a new route group.
helper foo => sub {...};
-Alias for L<Mojolicious/"helper">.
+Add a new helper with L<Mojolicious/"helper">.
=head2 C<hook>
hook after_dispatch => sub {...};
-Alias for L<Mojolicious/"hook">.
+Share code with L<Mojolicious/"hook">.
=head2 C<options>
@@ -992,9 +992,9 @@ C<PATCH> requests. See also the tutorial above for more argument variations.
=head2 C<plugin>
- plugin 'SomeThing';
+ plugin SomePlugin => {foo => 23};
-Alias for L<Mojolicious/"plugin">.
+Load a plugin with L<Mojolicious/"plugin">.
=head2 C<post>

0 comments on commit 4186f5e

Please sign in to comment.