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
FormValidator::Lite::Constraint::Default(3) User Contributed Perl Documentation FormValidator::Lite::Constraint::Default(3)

FormValidator::Lite::Constraint::Default - default constraint rules

This module provides default constraint rules for FormValidator::Lite.

NOT_NULL
The parameter is true value or not.
NOT_BLANK, REQUIRED
Synonym of NOT_NULL.
INT
The parameter looks like a integer? i.e. It matches /^[+\-]?[0-9]+$/?
UINT
The parameter looks like a unsigned integer? i.e. It matches /^[0-9]+$/?
ASCII
    $_ =~ /^[\x21-\x7E]+$/
    

The parameter is just ASCII?

DUPLICATION
    $validator->check(
        {mails => [qw/mail1 mail2/]} => ['DUPLICATION']
    );
    

The two parameters have same value?

DUP
Synonym of DUPLICATION.
LENGTH
    $validator->check(
        name     => [[qw/LENGTH 5 20/]],
        password => [[qw/LENGTH 5/]],
    );
    

Check the length of data. First argument means $minumum value, second argument is $max. $max is optional.

EQUAL
    $validator->check(
        name => [[EQUAL => "foo"]],
    );
    

Check parameter match the argument or not.

REGEX
    $validator->check(
        name => [[REGEXP => qr/^[0-9]$/]],
    );
    

Check regexp matches parameter or not.

REGEXP
Synonym of REGEX.
CHOICE
    $validator->check(
        sex => [[CHOICE => qw/male female/]]
    );
    

The parameter is one of choice or not.

IN
Synonym of CHOICE.
NOT_IN
    $validator->check(
        new_user => [[NOT_IN => \@existing_users]]
    );
    

The parameter does not belong to the list of values.

MATCH
    use MyApp::Util qw/is_foo/;

    $validator->check(
        foo => [[MATCH => \&is_foo ]],
        bar => [[MATCH => sub { $_[0] eq 'foo' } ]],
    );
    

Check parameter using callback. Callback takes parameter as first argument, should return true/false.

FILTER
    $validator->check(
        foo => [[FILTER => 'trim'], 'INT'],
        bar => [[FILTER => sub { $_[0] . '@example.com' } ], 'EMAIL'],
    );
    

FILTER is special constraint. It does not check the value and simply filter. "trim" is only pre-defined. You can also pass a callback. Callback takes parameter as first argument, should return filtered value.

FLAG
    $validator->check(
        is_enabled => [qw/FLAG/]
    );
    

Check parameter is 0 or 1.

2021-08-14 perl v5.32.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.