NAME

Mojo::Parameters - Parameter container

SYNOPSIS

use Mojo::Parameters;

my $params = Mojo::Parameters->new(foo => 'bar', baz => 23);

DESCRIPTION

Mojo::Parameters is a container for form parameters.

ATTRIBUTES

Mojo::Parameters implements the following attributes.

charset

my $charset = $params->charset;
$params     = $params->charset('UTF-8');

Charset used for decoding parameters, defaults to UTF-8.

pair_separator

my $separator = $params->pair_separator;
$params       = $params->pair_separator(';');

Separator for parameter pairs, defaults to &.

METHODS

Mojo::Parameters inherits all methods from Mojo::Base and implements the following new ones.

new

my $params = Mojo::Parameters->new;
my $params = Mojo::Parameters->new('foo=b%3Bar&baz=23');
my $params = Mojo::Parameters->new(foo => 'b;ar', baz => 23);

Construct a new Mojo::Parameters object.

append

$params = $params->append(foo => 'ba;r');

Append parameters.

clone

my $params2 = $params->clone;

Clone parameters.

merge

$params = $params->merge($params2, $params3);

Merge parameters.

param

my @names = $params->param;
my $foo   = $params->param('foo');
my @foo   = $params->param('foo');
my $foo   = $params->param(foo => 'ba;r');

Check parameter values.

params

my $parameters = $params->params;
$params        = $params->params([foo => 'b;ar', baz => 23]);

Parsed parameters.

parse

$params = $params->parse('foo=b%3Bar&baz=23');

Parse parameters.

remove

$params = $params->remove('foo');

Remove a parameter.

to_hash

my $hash = $params->to_hash;

Turn parameters into a hashref.

to_string

my $string = $params->to_string;

Turn parameters into a string.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.