Skip to content

Commit

Permalink
added a few parameter examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 19, 2012
1 parent 6c9c690 commit f519f62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 1 addition & 9 deletions lib/Mojo/Message/Response.pm
Expand Up @@ -7,15 +7,7 @@ use Mojo::Util 'get_line';

has [qw/code message/];

my $START_LINE_RE = qr|
^\s*
HTTP/(\d\.\d) # Version
\s+
(\d\d\d) # Code
\s*
([^\x0d\x0a]+)? # Message (with "I'm a teapot" support)
$
|x;
my $START_LINE_RE = qr|^\s*HTTP/(\d\.\d)\s+(\d\d\d)\s*(.+)?$|x;

# Umarked codes are from RFC 2616
my %MESSAGES = (
Expand Down
13 changes: 11 additions & 2 deletions lib/Mojo/Parameters.pm
Expand Up @@ -258,6 +258,9 @@ Construct a new L<Mojo::Parameters> object.
Append parameters.
# "foo=bar&foo=baz"
Mojo::Parameters->new('foo=bar')->append(foo => 'baz');
=head2 C<clone>
my $params2 = $params->clone;
Expand All @@ -277,7 +280,7 @@ Merge parameters.
my @foo = $params->param('foo');
my $foo = $params->param(foo => 'ba;r');
Check parameter values.
Check and replace parameter values.
=head2 C<params>
Expand All @@ -296,14 +299,20 @@ Parse parameters.
$params = $params->remove('foo');
Remove a parameter.
Remove parameters.
# "bar=yada"
Mojo::Parameters->new('foo=bar&foo=baz&bar=yada')->remove('foo');
=head2 C<to_hash>
my $hash = $params->to_hash;
Turn parameters into a hashref.
# "baz"
Mojo::Parameters->new('foo=bar&foo=baz')->to_hash->{foo}->[1];
=head2 C<to_string>
my $string = $params->to_string;
Expand Down

0 comments on commit f519f62

Please sign in to comment.