Permalink
Browse files

documentation tweaks

  • Loading branch information...
1 parent caa15b9 commit 008a388ce0fcfd12ffd7414948df1acb864633a1 @kraih committed Aug 8, 2012
Showing with 13 additions and 10 deletions.
  1. +1 −0 Changes
  2. +4 −5 lib/Mojo/Server/Daemon.pm
  3. +2 −2 lib/Mojo/UserAgent.pm
  4. +6 −3 lib/Test/Mojo.pm
View
@@ -1,5 +1,6 @@
3.25 2012-08-08
+ - Improved documentation.
- Fixed cleanup bugs in Mojo::Server::Daemon and Mojo::UserAgent.
3.24 2012-08-08
@@ -126,13 +126,12 @@ sub _finish {
}
# Close connection if necessary
- if ($tx->req->error || !$tx->keep_alive) { $self->_remove($id) }
+ return $self->_remove($id) if $tx->req->error || !$tx->keep_alive;
# Build new transaction for leftovers
- elsif (defined(my $leftovers = $tx->server_leftovers)) {
- $tx = $c->{tx} = $self->_build_tx($id, $c);
- $tx->server_read($leftovers);
- }
+ return unless defined(my $leftovers = $tx->server_leftovers);
+ $tx = $c->{tx} = $self->_build_tx($id, $c);
+ $tx->server_read($leftovers);
}
sub _group {
@@ -321,7 +321,7 @@ sub _finish {
sub _handle {
my ($self, $id, $close) = @_;
- # Request timeout
+ # Remove request timeout
my $c = $self->{connections}{$id};
$self->_loop->remove($c->{timeout}) if $c->{timeout};
@@ -352,7 +352,7 @@ sub _handle {
unless $self->_redirect($c, $old);
}
- # Stop loop
+ # Stop loop if necessary
$self->ioloop->stop if !$self->{nb} && !keys %{$self->{connections}};
}
View
@@ -344,14 +344,17 @@ Test::Mojo - Testing Mojo!
my $t = Test::Mojo->new('MyApp');
+ # HTML5/XML
$t->get_ok('/welcome')->status_is(200)->text_is('div#message' => 'Hello!');
+ # JSON
$t->post_form_ok('/search.json' => {q => 'Perl'})
->status_is(200)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->header_isnt('X-Bender' => 'Bite my shiny metal ass!');
->json_is('/results/4/title' => 'Perl rocks!');
+ # WebSocket
$t->websocket_ok('/echo')
->send_ok('hello')
->message_is('echo: hello')
@@ -506,7 +509,7 @@ same arguments as L<Mojo::UserAgent/"delete">.
$t = $t->element_exists('div.foo[x=y]');
$t = $t->element_exists('html head title', 'has a title');
-Checks for existence of the CSS3 selectors first matching XML/HTML element
+Checks for existence of the CSS3 selectors first matching HTML5/XML element
with L<Mojo::DOM>.
=head2 C<element_exists_not>
@@ -728,7 +731,7 @@ Opposite of C<status_is>.
$t = $t->text_is('div.foo[x=y]' => 'Hello!');
$t = $t->text_is('html head title' => 'Hello!', 'right title');
-Checks text content of the CSS3 selectors first matching XML/HTML element for
+Checks text content of the CSS3 selectors first matching HTML5/XML element for
exact match with L<Mojo::DOM>.
=head2 C<text_isnt>
@@ -743,7 +746,7 @@ Opposite of C<text_is>.
$t = $t->text_like('div.foo[x=y]' => qr/Hello/);
$t = $t->text_like('html head title' => qr/Hello/, 'right title');
-Checks text content of the CSS3 selectors first matching XML/HTML element for
+Checks text content of the CSS3 selectors first matching HTML5/XML element for
similar match with L<Mojo::DOM>.
=head2 C<text_unlike>

0 comments on commit 008a388

Please sign in to comment.