Skip to content

Commit

Permalink
added a few message examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 5, 2011
1 parent 1cba787 commit 15bb69b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for Perl extension Mojolicious.

2.24 2011-11-05 00:00:00
- Added EXPERIMENTAL canonicalize method to Mojo::URL.
- Improved documentation.
- Fixed small path canonicalization bug in Mojo::URL.
- Fixed small trailing slash bug in Mojo::Path.

Expand Down
14 changes: 14 additions & 0 deletions lib/Mojo/Message.pm
Expand Up @@ -656,6 +656,8 @@ which will be emitted when new data arrives.
C<POST> parameters, usually a L<Mojo::Parameters> object.
say $message->body_params->param('foo');
=head2 C<body_size>
my $size = $message->body_size;
Expand Down Expand Up @@ -688,6 +690,8 @@ Render start line.
Access message cookies, usually L<Mojo::Cookie::Request> or
L<Mojo::Cookie::Response> objects.
say $message->cookie('foo')->value;
=head2 C<dom>
my $dom = $message->dom;
Expand All @@ -696,6 +700,8 @@ L<Mojo::Cookie::Response> objects.
Turns content into a L<Mojo::DOM> object and takes an optional selector to
perform a C<find> on it right away, which returns a collection.
$message->dom('h1, h2, h3')->each(sub { say $_->text });
=head2 C<error>
my $message = $message->error;
Expand Down Expand Up @@ -748,6 +754,8 @@ Size of headers in bytes.
Message headers, defaults to a L<Mojo::Headers> object.
say $message->headers->content_type;
=head2 C<is_chunked>
my $success = $message->is_chunked;
Expand Down Expand Up @@ -788,6 +796,8 @@ Check if message content is a L<Mojo::Content::MultiPart> object.
Decode JSON message body directly using L<Mojo::JSON> if possible, returns
C<undef> otherwise.
say $message->json->{foo}->{bar}->[23];
=head2 C<leftovers>
my $bytes = $message->leftovers;
Expand Down Expand Up @@ -839,12 +849,16 @@ Render whole message.
Access C<multipart/form-data> file uploads, usually L<Mojo::Upload> objects.
say $message->upload('foo')->asset->slurp;
=head2 C<uploads>
my $uploads = $message->uploads;
All C<multipart/form-data> file uploads, usually L<Mojo::Upload> objects.
say $message->uploads->[2]->filename;
=head2 C<version>
my $version = $message->version;
Expand Down
6 changes: 6 additions & 0 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -428,6 +428,8 @@ Note that this method is EXPERIMENTAL and might change without warning!
Access request cookies, usually L<Mojo::Cookie::Request> objects.
say $req->cookies->[1]->value;
=head2 C<fix_headers>
$req = $req->fix_headers;
Expand Down Expand Up @@ -458,6 +460,8 @@ Access C<GET> and C<POST> parameters.
All C<GET> and C<POST> parameters, usually a L<Mojo::Parameters> object.
say $req->params->param('foo');
=head2 C<parse>
$req = $req->parse('GET /foo/bar HTTP/1.1');
Expand All @@ -480,6 +484,8 @@ Proxy URL for message.
All C<GET> parameters, usually a L<Mojo::Parameters> object.
say $req->query_params->param('foo');
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojo/Message/Response.pm
Expand Up @@ -226,6 +226,8 @@ implements the following new ones.
Access response cookies, usually L<Mojo::Cookie::Response> objects.
say $res->cookies->[1]->value;
=head2 C<default_message>
my $message = $res->default_message;
Expand Down

0 comments on commit 15bb69b

Please sign in to comment.