Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Validator::Custom::ResUser3Contributed Perl DocumeValidator::Custom::Result(3)

NAME
       Validator::Custom::Result - Result of validation

SYNOPSYS
	 # Result
	 my $result = $vc->validate($data, $rule);

	 # Safety data
	 my $safe_data = $result->data;

	 # Chacke if the result	is valid.
	 # (this means result have neither missing nor invalid parameter)
	 my $is_ok = $result->is_ok;

	 # Check the existence of missing parameter
	 my $has_missing_param = $result->has_missing;

	 # Check if one	parameter is valid
	 my $title_is_valid = $result->is_valid('title');

	 # Missing parameters(this is original keys)
	 my $missing_params = $result->missing_params;

	 # Invalid parameter names(this	is original keys)
	 my $invalid_params = $result->invalid_params;

	 # Invalid rule	keys
	 my $invalid_rule_keys = $result->invalid_rule_keys;

	 # A error message
	 my $message = $result->message('title');

	 # Error messages
	 my $messages =	$result->messages;

	 # Error messages to hash ref
	 my $messages_hash = $result->message_to_hash;

	 # Result to hash
	 my $rhash = $result->to_hash;

	 # Raw data
	 my $raw_data =	$result->raw_data;

ATTRIBUTES
   data
	 my $data = $result->data;
	 $result  = $result->data($data);

       Get the data in the end state. Validator::Custom	has filtering ability
       if you need.  The data passed to	"validate()" is	converted to other
       data by filter.	You can	get filtered data using	"data()".

   missing_params
	 my $missing_params = $result->missing_params;
	 $result	    = $result->missing_params($missing_params);

       You can get missing parameter names using "missing_params()".  In this
       example,	return value is	the following one.

   raw_data
	 my $data  = $result->raw_data;
	 $result   = $result->raw_data($data);

       Raw data	soon after data_filter is executed.

METHODS
       Validator::Custom::Result inherits all methods from Object::Simple and
       implements the following	new ones.

   has_invalid
	 my $has_invalid = $result->has_invalid;

       If at least one of parameter value is invalid, "has_invalid()" return
       true value.

   has_missing
	 my $has_missing_param = $result->has_missing;

       If at least one of parameter names specified in the rule	is not found
       in the data, "has_missing()" return true	value.

   invalid_params
	 my $invalid_params = $result->invalid_params;

       Invalid raw data	parameter names.

   invalid_rule_keys
	 my $invalid_rule_keys = $result->invalid_rule_keys;

       Invalid rule keys

   is_ok
	 my $is_ok = $result->is_ok;

       If you check the	data is	completely valid, use "is_ok()".  "is_ok()"
       return true value if invalid parameter values is	not found and all
       parameter names specified in the	rule is	found in the data.

   is_valid
	 my $title_is_valid = $result->is_valid('title');

       Check if	one parameter is valid.

   loose_data
	 my $loose_data	= $result->loose_data;

       Loose data, which is data merged	"raw_data" and "data"

	 # Loose data
	 {%{$self->raw_data}, %{$self->data}}

   message
	 my $message = $result->message('title');

       Get a message corresponding to the parameter name which value is
       invalid.

   messages
	 my $messages =	$result->messages;

       Get messages corresponding to the parameter names which value is
       invalid.	 Messages keep the order of parameter names of the rule.

   messages_to_hash
	 my $messages =	$result->messages_to_hash;

       You can get the pairs of	invalid	parameter name and message using
       "messages_to_hash()".

   to_hash
	 my $rhash = $result->to_hash;

       Convert result information to hash reference.  The following keys is
       set.

	 {
	   ok =>      $result->is_ok,
	   missing => $result->has_missing,
	   invalid => $result->has_invalid,
	   missing_params => $result->missing_params,
	   messages => $result->messages_to_hash
	 }

perl v5.24.1			  2015-12-07	  Validator::Custom::Result(3)

NAME | SYNOPSYS | ATTRIBUTES | METHODS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Validator::Custom::Result&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help