This module contains a set of procedures for validating data types. The check_* procedures take the value to validate and potential extra arguments and return either undef if the validation succeeded or the reason of the failure.
check_*
use Zonemaster::Backend::Validator qw( :format ); # prints "invalid value: The domain name character(s) are not supported" if ( defined ( my $error = check_domain( 'not a domain' ) ) ) { print "invalid value: $error\n"; } else { print "value is valid\n"; } # prints "value is valid" if ( defined ( my $error = check_domain( 'zonemaster.net' ) ) ) { print "invalid value: $error\n"; } else { print "value is valid\n"; }
Returns a hashref to be used with the "format" method in JSON::Validator. The keys are the names of the custom formats, supports: domain, language_tag, ip and profile.
domain
language_tag
ip
profile
The method takes a Config object as argument.
Validates a domain name.
Validates a https://github.com/zonemaster/zonemaster/blob/master/docs/public/using/backend/rpcapi-reference.md#language-tag.
A hash of configured locales, as returned by Zonemaster::Backend::Config::LANGUAGE_locale.
Validates an IP address.
Validates a profile name.
A hash of configured profiles, as returned by Zonemaster::Backend::Config::PUBLIC_PROFILES.
This module contains a set of procedures for validating and untainting strings.
use Zonemaster::Backend::Validator qw( :untaint ); # prints "untainted: sqlite" if ( defined ( my $value = untaint_engine_type( 'sqlite' ) ) ) { print "untainted: $value\n"; } # does not print anything if ( defined ( my $value = untaint_engine_type( 'Excel' ) ) ) { print "untainted: $value\n"; }
These procedures all take a possibly tainted single string argument. If the string is accepted an untainted copy of the string is returned.
Accepts the strings "MySQL", "PostgreSQL" and "SQLite", case-insensitively.
"MySQL"
"PostgreSQL"
"SQLite"
Accepts an IPv4 or IPv6 address.
Accepts an IPv4 address.
Accepts an IPv6 address.
Accepts an LDH domain name or an IPv4 or IPv6 address.
Accepts an LDH domain name.
Accepts a locale tag.
To install Zonemaster::Backend, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zonemaster::Backend
CPAN shell
perl -MCPAN -e shell install Zonemaster::Backend
For more information on module installation, please visit the detailed CPAN module installation guide.