Dave Rolsky > Chloro-0.06 > Chloro::ResultSet

Download:
Chloro-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.06   Source  

NAME ^

Chloro::ResultSet - The set of results from processing a form submission

VERSION ^

version 0.06

SYNOPSIS ^

    my $resultset = $form->process( params => $params );

    if ( $resultset->is_valid() ) {
        do_something( $resultset->results_as_hash() ):
    }
    else {
        # handle errors
    }

DESCRIPTION ^

This class represents the set of results from processing an entire form submission.

This includes results for individual fields and for groups, as well as validation errors for the form as a whole.

METHODS ^

This class has the following methods:

Chloro::ResultSet->new()

The constructor accepts the following arguments:

$resultset->results()

Returns a list of Chloro::Result::Field and Chloro::Result::Group objects.

$resultset->result_for($key)

Given a field name or a group prefix, returns a Chloro::Result::Field or Chloro::Result::Group object

$resultset->is_valid()

This returns true if there are no field or form errors in this resultset.

$resultset->results_as_hash()

This takes all the result objects as assembles them into a data hash reference. See Chloro::Manual::Groups for details on how group results are returned.

$resultset->secure_results_as_hash()

This is just like $resultset->results_as_hash(), but the result for any field marked as secure is omitted. This is useful if you need to pass the form data in a query string or session, and you don't want to include things like credit card numbers or passwords.

$resultset->secure_raw_params()

Returns a hash reference of the original parameters passed to $form->process() with any fields marked secure removed.

Note that if the keys in the original params do not match the field names (because you used a custom extractor), then those keys will still be in the returned hash reference.

$resultset->form_errors()

Returns a list of Chloro::Error::Form objects. This list may be empty.

$resultset->add_form_error()

Adds a Chloro::Error::Form object to the resultset.

$resultset->field_errors()

This returns a hash of errors associated with the fields. The hash keys are either plain field names, or a prefixed name for fields in groups. The value for each key is an array reference of error objects.

Fields without errors are not included in the hash.

$resultset->all_errors()

This method returns all the errors in the resultset, both form and field. They are returned a list.

ROLES ^

This class does the Chloro::Role::Result and Chloro::Role::ResultSet 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)
syntax highlighting: