Provided by: libdata-formvalidator-perl_4.88-1_all bug

NAME

       Data::FormValidator::Results - results of form input validation.

SYNOPSIS

           my $results = Data::FormValidator->check(\%input_hash, \%dfv_profile);

           # Print the name of missing fields
           if ( $results->has_missing ) {
           for my $f ( $results->missing ) {
               print $f, " is missing\n";
           }
           }

           # Print the name of invalid fields
           if ( $results->has_invalid ) {
           for my $f ( $results->invalid ) {
               print $f, " is invalid: ", $results->invalid( $f ), "\n";
           }
           }

           # Print unknown fields
           if ( $results->has_unknown ) {
           for my $f ( $results->unknown ) {
               print $f, " is unknown\n";
           }
           }

           # Print valid fields
           for my $f ( $results->valid() ) {
               print $f, " =  ", $results->valid( $f ), "\n";
           }

DESCRIPTION

       This object is returned by the Data::FormValidator "check" method.  It can be queried for
       information about the validation results.

success();
       This method returns true if there were no invalid or missing fields, else it returns
       false.

       As a shorthand, When the $results object is used in boolean context, it is overloaded to
       use the value of success() instead. That allows creation of a syntax like this one used in
       "CGI::Application::Plugin::ValidateRM":

        my $results = $self->check_rm('form_display','_form_profile') || return $self->dfv_error_page;

valid( [[field] [, value]] );

       In list context with no arguments, it returns the list of fields which contain valid
       values:

        @all_valid_field_names = $r->valid;

       In a scalar context with no arguments, it returns an hash reference which contains the
       valid fields as keys and their input as values:

        $all_valid_href = $r->valid;

       If called with one argument in scalar context, it returns the value of that "field" if it
       contains valid data, "undef" otherwise. The value will be an array ref if the field had
       multiple values:

        $value = $r->valid('field');

       If called with one argument in list context, it returns the values of "field" as an array:

        @values = $r->valid('field');

       If called with two arguments, it sets "field" to "value" and returns "value".  This form
       is useful to alter the results from within some constraints.  See the
       Data::FormValidator::Constraints documentation.

        $new_value = $r->valid('field',$new_value);

has_missing()
       This method returns true if the results contain missing fields.

missing( [field] )

       In list context it returns the list of fields which are missing.  In a scalar context, it
       returns an array reference to the list of missing fields.

       If called with an argument, it returns true if that "field" is missing, undef otherwise.

has_invalid()
       This method returns true if the results contain fields with invalid data.

invalid( [field] )

       In list context, it returns the list of fields which contains invalid value.

       In a scalar context, it returns an hash reference which contains the invalid fields as
       keys, and references to arrays of failed constraints as values.

       If called with an argument, it returns the reference to an array of failed constraints for
       "field".

has_unknown()
       This method returns true if the results contain unknown fields.

unknown( [field] )

       In list context, it returns the list of fields which are unknown.  In a scalar context, it
       returns an hash reference which contains the unknown fields and their values.

       If called with an argument, it returns the value of that "field" if it is unknown, undef
       otherwise.

msgs([config parameters])

       This method returns a hash reference to error messages. The exact format is determined by
       parameters in the "msgs" area of the validation profile, described in the
       Data::FormValidator documentation.

       NOTE: the "msgs" parameter in the profile can take a code reference as a value, allowing
       complete control of how messages are generated. If such a code reference was provided
       there, it will be called here instead of the usual processing, described below. It will
       receive as arguments the Data::FormValidator::Results object and a hash reference of
       control parameters.

       The hashref passed in should contain the same options that you can define in the
       validation profile. This allows you to separate the controls for message display from the
       rest of the profile. While validation profiles may be different for every form, you may
       wish to format messages the same way across many projects.

       Controls passed into the <msgs> method will be applied first, followed by ones applied in
       the profile. This allows you to keep the controls you pass to "msgs" as "global" and
       override them in a specific profile if needed.

meta()
       In a few cases, a constraint may discover meta data that is useful to access later. For
       example, when using Data::FormValidator::Constraints::Upload, several bits of meta data
       are discovered about files in the process of validating. These can include "bytes",
       "width", "height" and "extension".  The "meta()" function is used by constraint methods to
       set this data. It's also used to access this data. Here are some examples.

        # return all field names that have meta data
        my @fields = $results->meta();

        # To retrieve all meta data for a field:
        $meta_href = $results->meta('img');

        # Access a particular piece:
        $width = $results->meta('img')->{width};

       Here's how to set some meta data. This is useful to know if you are writing your own
       complex constraint.

           $self->meta('img', {
               width  => '50',
               height => '60',
           });

       This function does not currently support multi-valued fields. If it does in the future,
       the above syntax will still work.

SEE ALSO

       Data::FormValidator, Data::FormValidator::Filters, Data::FormValidator::Constraints,
       Data::FormValidator::ConstraintsFactory

AUTHOR

       Author: Francis J. Lacoste <francis.lacoste@iNsu.COM> Maintainer: Mark Stosberg
       <mark@summersault.com>

COPYRIGHT

       Copyright (c) 1999,2000 iNsu Innovations Inc.  All rights reserved.

       This program is free software; you can redistribute it and/or modify it under the terms as
       perl itself.