GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Validator::Custom::Result(3) User Contributed Perl Documentation Validator::Custom::Result(3)
 

Validator::Custom::Result - Result of validation

  # 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;

  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()".

  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.

  my $data  = $result->raw_data;
  $result   = $result->raw_data($data);
Raw data soon after data_filter is executed.

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

  my $has_invalid = $result->has_invalid;
If at least one of parameter value is invalid, "has_invalid()" return true value.

  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.

  my $invalid_params = $result->invalid_params;
Invalid raw data parameter names.

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

  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.

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

  my $loose_data = $result->loose_data;
Loose data, which is data merged "raw_data" and "data"
  # Loose data
  {%{$self->raw_data}, %{$self->data}}

  my $message = $result->message('title');
Get a message corresponding to the parameter name which value is invalid.

  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.

  my $messages = $result->messages_to_hash;
You can get the pairs of invalid parameter name and message using "messages_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
  }
2015-12-07 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.