---
name: "Validation::Class::Simple"
section: "3pm"
platform: "linux"
package: "libvalidation-class-perl"
version: "7.900059-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Validation::Class::Simple"
---

# Validation::Class::Simple(3pm)

Simple Ad-Hoc Data Validation

## NAME

Validation::Class::Simple - Simple Ad-Hoc Data Validation

## VERSION

version 7.900059

## SYNOPSIS

```
    use Validation::Class::Simple;
    my $params = {
        name  => 'Root',
        email => 'root@localhost',
        pass  => 's3cret',
        pass2 => 's2cret'
    };
    # define object specific rules
    my $rules = Validation::Class::Simple->new(
        # define fields on-the-fly
        fields => {
            name  => { required => 1 },
            email => { required => 1 },
            pass  => { required => 1 },
            pass2 => { required => 1, matches => 'pass' },
        }
    );
    # set parameters to be validated
    $rules->params->add($params);
    # validate
    unless ($rules->validate) {
        # handle the failures
        warn $rules->errors_to_string;
    }
```

## DESCRIPTION

Validation::Class::Simple is a simple validation module built around the powerful Validation::Class data validation framework.

This module is merely a blank canvas, a clean validation class derived from Validation::Class which has not been pre-configured (e.g. configured via keywords, etc).

It can be useful in an environment where you wouldn't care to create a validation class and instead would simply like to pass rules to a validation engine in an ad-hoc fashion.

## QUICKSTART

If you are looking for a data validation module with an even lower learning curve built using the same tenets and principles as Validation::Class which is as simple and even lazier than this module, please review the documentation for Validation::Class::Simple::Streamer. Please review the "GUIDED-TOUR" in Validation::Class::Cookbook for a detailed step-by-step look into how Validation::Class works.

## RATIONALE

If you are new to Validation::Class, or would like more information on the underpinnings of this library and how it views and approaches data validation, please review Validation::Class::Whitepaper.

## PROXY METHODS

Each instance of Validation::Class::Simple is associated with a prototype class which provides the data validation engine and keeps the class namespace free from pollution and collisions, please see Validation::Class::Prototype for more information on specific methods and attributes.

Validation::Class::Simple is injected with a few proxy methods which are basically aliases to the corresponding prototype (engine) class methods, however it is possible to access the prototype directly using the proto/prototype methods.

### class

```
    $self->class;
```

See "class" in Validation::Class::Prototype for full documentation.

### clear\_queue

```
    $self->clear_queue;
```

See "clear\_queue" in Validation::Class::Prototype for full documentation.

### error\_count

```
    $self->error_count;
```

See "error\_count" in Validation::Class::Prototype for full documentation.

### error\_fields

```
    $self->error_fields;
```

See "error\_fields" in Validation::Class::Prototype for full documentation.

### errors

```
    $self->errors;
```

See "errors" in Validation::Class::Prototype for full documentation.

### errors\_to\_string

```
    $self->errors_to_string;
```

See "errors\_to\_string" in Validation::Class::Prototype for full documentation.

### get\_errors

```
    $self->get_errors;
```

See "get\_errors" in Validation::Class::Prototype for full documentation.

### get\_fields

```
    $self->get_fields;
```

See "get\_fields" in Validation::Class::Prototype for full documentation.

### get\_hash

```
    $self->get_hash;
```

See "get\_hash" in Validation::Class::Prototype for full documentation.

### get\_params

```
    $self->get_params;
```

See "get\_params" in Validation::Class::Prototype for full documentation.

### get\_values

```
    $self->get_values;
```

See "get\_values" in Validation::Class::Prototype for full documentation.

### fields

```
    $self->fields;
```

See "fields" in Validation::Class::Prototype for full documentation.

### filtering

```
    $self->filtering;
```

See "filtering" in Validation::Class::Prototype for full documentation.

### ignore\_failure

```
    $self->ignore_failure;
```

See "ignore\_failure" in Validation::Class::Prototype for full documentation.

### ignore\_unknown

```
    $self->ignore_unknown;
```

See "ignore\_unknown" in Validation::Class::Prototype for full documentation.

### is\_valid

```
    $self->is_valid;
```

See "is\_valid" in Validation::Class::Prototype for full documentation.

### param

```
    $self->param;
```

See "param" in Validation::Class::Prototype for full documentation.

### params

```
    $self->params;
```

See "params" in Validation::Class::Prototype for full documentation.

### plugin

```
    $self->plugin;
```

See "plugin" in Validation::Class::Prototype for full documentation.

### queue

```
    $self->queue;
```

See "queue" in Validation::Class::Prototype for full documentation.

### report\_failure

```
    $self->report_failure;
```

See "report\_failure" in Validation::Class::Prototype for full documentation.

### report\_unknown

```
    $self->report_unknown;
```

See "report\_unknown" in Validation::Class::Prototype for full documentation.

### reset\_errors

```
    $self->reset_errors;
```

See "reset\_errors" in Validation::Class::Prototype for full documentation.

### reset\_fields

```
    $self->reset_fields;
```

See "reset\_fields" in Validation::Class::Prototype for full documentation.

### reset\_params

```
    $self->reset_params;
```

See "reset\_params" in Validation::Class::Prototype for full documentation.

### set\_errors

```
    $self->set_errors;
```

See "set\_errors" in Validation::Class::Prototype for full documentation.

### set\_fields

```
    $self->set_fields;
```

See "set\_fields" in Validation::Class::Prototype for full documentation.

### set\_params

```
    $self->set_params;
```

See "set\_params" in Validation::Class::Prototype for full documentation.

### set\_method

```
    $self->set_method;
```

See "set\_method" in Validation::Class::Prototype for full documentation.

### stash

```
    $self->stash;
```

See "stash" in Validation::Class::Prototype for full documentation.

### validate

```
    $self->validate;
```

See "validate" in Validation::Class::Prototype for full documentation.

### validate\_document

```
    $self->validate_document;
```

See "validate\_document" in Validation::Class::Prototype for full documentation.

### validate\_method

```
    $self->validate_method;
```

See "validate\_method" in Validation::Class::Prototype for full documentation.

### validate\_profile

```
    $self->validate_profile;
```

See "validate\_profile" in Validation::Class::Prototype for full documentation.

## EXTENSIBILITY

Validation::Class does NOT provide method modifiers but can be easily extended with Class::Method::Modifiers.

### before

```
    before foo => sub { ... };
```

See "before method(s) =\> sub { ... }" in Class::Method::Modifiers for full documentation.

### around

```
    around foo => sub { ... };
```

See "around method(s) =\> sub { ... }" in Class::Method::Modifiers for full documentation.

### after

```
    after foo => sub { ... };
```

See "after method(s) =\> sub { ... }" in Class::Method::Modifiers for full documentation.

## AUTHOR

Al Newkirk \<anewkirk@ana.io\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Al Newkirk.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
