Skip to content

Commit

Permalink
be more specific about which value is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 8, 2014
1 parent a6b908f commit 1d916ba
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 26 deletions.
14 changes: 8 additions & 6 deletions lib/Mojo/Message.pm
Expand Up @@ -461,9 +461,10 @@ Render start line.
my ($foo, $bar) = $msg->cookie(['foo', 'bar']);
Access message cookies, usually L<Mojo::Cookie::Request> or
L<Mojo::Cookie::Response> objects. To access multiple cookies sharing the same
name you can also use L</"every_cookie">. Note that this method caches all
data, so it should not be called before all headers have been received.
L<Mojo::Cookie::Response> objects. If there are multiple cookies sharing the
same name, and you want to access more than just the last one, you can use
L</"every_cookie">. Note that this method caches all data, so it should not be
called before all headers have been received.
# Get cookie value
say $msg->cookie('foo')->value;
Expand Down Expand Up @@ -630,9 +631,10 @@ Render whole message.
my ($foo, $bar) = $msg->upload(['foo', 'bar']);
Access C<multipart/form-data> file uploads, usually L<Mojo::Upload> objects.
To access multiple uploads sharing the same name you can also use
L</"every_upload">. Note that this method caches all data, so it should not be
called before the entire message body has been received.
If there are multiple uploads sharing the same name, and you want to access
more than just the last one, you can use L</"every_upload">. Note that this
method caches all data, so it should not be called before the entire message
body has been received.
# Get content of uploaded file
say $msg->upload('foo')->asset->slurp;
Expand Down
11 changes: 6 additions & 5 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -407,11 +407,12 @@ Check C<X-Requested-With> header for C<XMLHttpRequest> value.
Access C<GET> and C<POST> parameters extracted from the query string and
C<application/x-www-form-urlencoded> or C<multipart/form-data> message body.
To access multiple values sharing the same name you can also use
L</"every_param">. Note that this method caches all data, so it should not be
called before the entire request body has been received. Parts of the request
body need to be loaded into memory to parse C<POST> parameters, so you have to
make sure it is not excessively large, there's a 10MB limit by default.
If there are multiple values sharing the same name, and you want to access
more than just the last one, you can use L</"every_param">. Note that this
method caches all data, so it should not be called before the entire request
body has been received. Parts of the request body need to be loaded into
memory to parse C<POST> parameters, so you have to make sure it is not
excessively large, there's a 10MB limit by default.
=head2 params
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Parameters.pm
Expand Up @@ -289,9 +289,9 @@ necessary.
$params = $params->param(foo => qw(ba&r baz));
$params = $params->param(foo => ['ba;r', 'baz']);
Access parameter values. To access multiple values sharing the same name you
can also use L</"every_param">. Note that this method will normalize the
parameters.
Access parameter values. If there are multiple values sharing the same name,
and you want to access more than just the last one, you can use
L</"every_param">. Note that this method will normalize the parameters.
=head2 params
Expand Down
22 changes: 12 additions & 10 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -496,8 +496,9 @@ Continue dispatch chain with L<Mojolicious::Routes/"continue">.
$c = $c->cookie(foo => 'bar');
$c = $c->cookie(foo => 'bar', {path => '/'});
Access request cookie values and create new response cookies. To access
multiple values sharing the same name you can also use L</"every_cookie">.
Access request cookie values and create new response cookies. If there are
multiple values sharing the same name, and you want to access more than just
the last one, you can use L</"every_cookie">.
# Create response cookie with domain and expiration date
$c->cookie(user => 'sri', {domain => 'example.com', expires => time + 60});
Expand Down Expand Up @@ -611,10 +612,11 @@ status.
Access route placeholder values that are not reserved stash values, file
uploads as well as C<GET> and C<POST> parameters extracted from the query
string and C<application/x-www-form-urlencoded> or C<multipart/form-data>
message body, in that order. To access multiple values sharing the same name
you can also use L</"every_param">. Parts of the request body need to be
loaded into memory to parse C<POST> parameters, so you have to make sure it is
not excessively large, there's a 10MB limit by default.
message body, in that order. If there are multiple values sharing the same
name, and you want to access more than just the last one, you can use
L</"every_param">. Parts of the request body need to be loaded into memory to
parse C<POST> parameters, so you have to make sure it is not excessively
large, there's a 10MB limit by default.
# Get first value
my $first = $c->every_param('foo')->[0];
Expand Down Expand Up @@ -878,10 +880,10 @@ on browser.
$c = $c->signed_cookie(foo => 'bar');
$c = $c->signed_cookie(foo => 'bar', {path => '/'});
Access signed request cookie values and create new signed response cookies. To
access multiple values sharing the same name you can also use
L</"every_signed_cookie">. Cookies failing HMAC-SHA1 signature verification
will be automatically discarded.
Access signed request cookie values and create new signed response cookies. If
there are multiple values sharing the same name, and you want to access more
than just the last one, you can use L</"every_signed_cookie">. Cookies failing
HMAC-SHA1 signature verification will be automatically discarded.
=head2 stash
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojolicious/Validator/Validation.pm
Expand Up @@ -232,8 +232,9 @@ Change validation L</"topic">.
my $value = $validation->param('foo');
my ($foo, $bar) = $validation->param(['foo', 'bar']);
Access validated parameters. To access multiple values sharing the same name
you can also use L</"every_param">.
Access validated parameters. If there are multiple values sharing the same
name, and you want to access more than just the last one, you can use
L</"every_param">.
=head2 required
Expand Down

0 comments on commit 1d916ba

Please sign in to comment.