The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Chloro::Result::Field - A result for a single field

VERSION

version 0.06

SYNOPSIS

    my $result = $resultset->result_for('field');

    print $result->field()->name() . ' = ' . $result->value();

DESCRIPTION

This class represents the result for a single field after processing user-submitted data.

METHODS

This class has the following methods:

Chloro::Result::Field->new()

The constructor accepts the following arguments:

  • errors

    An array reference of Chloro::Error::Field objects. This is required, but can be an empty reference.

  • field

    The Chloro::Field object for this result.

  • value

    The value for the result. This can be any data type.

$result->errors()

Returns a list of Chloro::Error::Field objects for this result.

$result->is_valid()

Returns true if there are no errors associated with this result.

$result->field()

Returns the Chloro::Field object for this result.

$result->param_names()

Returns an array reference of the parameter keys associated with this field. The names are returned by the extractor method. For most fields, this will always be a one value arrayref, but it could be empty or have multiple names with a custom extractor.

$result->value()

Returns the value for this field. This can be any data type, undef, non-reference, reference, object, etc.

$result->key_value_pairs()

Returns the result as a key/value pair, where the key is the field name. This is plural so that this class and the Chloro::Result::Group class can share an API.

ROLES

This class does the Chloro::Role::Result role.

AUTHOR

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)