Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more examples
  • Loading branch information
kraih committed Oct 23, 2011
1 parent 022f957 commit 748c652
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,6 +1,6 @@
This file documents the revision history for Perl extension Mojolicious.

2.10 2011-10-23 00:00:00
2.10 2011-10-24 00:00:00
- Improved documentation.
- Improved tests.

Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Content/MultiPart.pm
Expand Up @@ -243,7 +243,7 @@ Mojo::Content::MultiPart - HTTP 1.1 multipart content container
my $multi = Mojo::Content::MultiPart->new;
$multi->parse('Content-Type: multipart/mixed; boundary=---foobar');
my $part = $multi->parts->[4];
my $single = $multi->parts->[4];
=head1 DESCRIPTION
Expand Down
1 change: 0 additions & 1 deletion lib/Mojo/Cookie/Request.pm
Expand Up @@ -78,7 +78,6 @@ Mojo::Cookie::Request - HTTP 1.1 request cookie container
my $cookie = Mojo::Cookie::Request->new;
$cookie->name('foo');
$cookie->value('bar');
say $cookie;
=head1 DESCRIPTION
Expand Down
1 change: 0 additions & 1 deletion lib/Mojo/Cookie/Response.pm
Expand Up @@ -118,7 +118,6 @@ Mojo::Cookie::Response - HTTP 1.1 response cookie container
my $cookie = Mojo::Cookie::Response->new;
$cookie->name('foo');
$cookie->value('bar');
say $cookie;
=head1 DESCRIPTION
Expand Down
1 change: 1 addition & 0 deletions lib/Mojo/CookieJar.pm
Expand Up @@ -127,6 +127,7 @@ Mojo::CookieJar - Cookie jar for HTTP 1.1 user agents
=head1 SYNOPSIS
use Mojo::CookieJar;
my $jar = Mojo::CookieJar->new;
=head1 DESCRIPTION
Expand Down
1 change: 1 addition & 0 deletions lib/Mojo/Exception.pm
Expand Up @@ -220,6 +220,7 @@ Mojo::Exception - Exceptions with context
=head1 SYNOPSIS
use Mojo::Exception;
my $e = Mojo::Exception->new;
=head1 DESCRIPTION
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojo/IOWatcher/EV.pm
Expand Up @@ -99,6 +99,8 @@ Mojo::IOWatcher::EV - EV non-blocking I/O watcher
use Mojo::IOWatcher::EV;
my $watcher = Mojo::IOWatcher::EV->new;
=head1 DESCRIPTION
L<Mojo::IOWatcher::EV> is a minimalistic non-blocking I/O watcher with
Expand Down
9 changes: 7 additions & 2 deletions lib/Mojo/Message.pm
Expand Up @@ -650,8 +650,13 @@ Check if message is at least a specific version.
$message = $message->body('Hello!');
my $cb = $message->body(sub {...});
Access and replace text content or register C<read> event with content, which
will be emitted when new content arrives.
Access and replace text content or register C<read> event with C<content>,
which will be emitted when new data arrives.
$message->body(sub {
my ($message, $chunk) = @_;
say "Streaming: $chunk";
});
=head2 C<body_params>
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojo/Transaction/HTTP.pm
Expand Up @@ -327,6 +327,8 @@ Mojo::Transaction::HTTP - HTTP 1.1 transaction container
use Mojo::Transaction::HTTP;
my $tx = Mojo::Transaction::HTTP->new;
=head1 DESCRIPTION
L<Mojo::Transaction::HTTP> is a container for HTTP 1.1 transactions as
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -357,6 +357,8 @@ Mojo::Transaction::WebSocket - WebSocket transaction container
use Mojo::Transaction::WebSocket;
my $ws = Mojo::Transaction::WebSocket->new;
=head1 DESCRIPTION
L<Mojo::Transaction::WebSocket> is a container for WebSocket transactions as
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious.pm
Expand Up @@ -312,12 +312,12 @@ Request processing callback, defaults to calling the C<dispatch> method.
Generally you will use a plugin or controller instead of this, consider it
the sledgehammer in your toolbox.
my $old = $app->on_process;
my $next = $app->on_process;
$app->on_process(sub {
my ($self, $c) = @_;
return $c->render(text => 'Hello world!')
if $c->req->url->path->contains('/hello');
$self->$old($c);
$self->$next($c);
});
=head2 C<plugins>
Expand Down
3 changes: 3 additions & 0 deletions lib/Mojolicious/Plugins.pm
Expand Up @@ -98,6 +98,9 @@ Mojolicious::Plugins - Plugins
use Mojolicious::Plugins;
my $plugins = Mojolicious::Plugin->new;
$plugins->load_plugin('Config');
=head1 DESCRIPTION
L<Mojolicious::Plugins> is the plugin manager of L<Mojolicious>.
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -254,6 +254,8 @@ Mojolicious::Renderer - MIME type based renderer
use Mojolicious::Renderer;
my $renderer = Mojolicious::Renderer->new;
=head1 DESCRIPTION
L<Mojolicious::Renderer> is the standard L<Mojolicious> renderer.
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious/Sessions.pm
Expand Up @@ -92,6 +92,8 @@ Mojolicious::Sessions - Signed cookie based sessions
use Mojolicious::Sessions;
my $sessions = Mojolicious::Sessions->new;
=head1 DESCRIPTION
L<Mojolicious::Sessions> is a very simple signed cookie based session
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious/Static.pm
Expand Up @@ -166,6 +166,8 @@ Mojolicious::Static - Serve static files
use Mojolicious::Static;
my $static = Mojolicious::Static->new;
=head1 DESCRIPTION
L<Mojolicious::Static> is a dispatcher for static files with C<Range> and
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious/Types.pm
Expand Up @@ -68,6 +68,8 @@ Mojolicious::Types - MIME types
use Mojolicious::Types;
my $types = Mojolicious::Types->new;
=head1 DESCRIPTION
L<Mojolicious::Types> is a container for MIME types.
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/dispatcher_lite_app.t
Expand Up @@ -15,13 +15,13 @@ use Mojolicious::Lite;
use Test::Mojo;

# Wrap whole application
my $old = app->on_process;
my $next = app->on_process;
app->on_process(
sub {
my ($self, $c) = @_;
return $c->render(text => 'Wrapped!')
if $c->req->url->path->contains('/wrap');
$self->$old($c);
$self->$next($c);
}
);

Expand Down

0 comments on commit 748c652

Please sign in to comment.