
Params::Validate::Checks::Net - Params::Validate checks for functions taking network-related arguments

use Params::Validate::Checks qw<validate as>;
use Params::Validate::Checks::Net;
sub configure_website
{
my %arg = validate @_,
{
website => {as 'domain'},
nameserver => {as 'domain'},
ip_address => {as 'public_ip_address'},
};
# Do something with $arg{website}, $arg{nameserver}, $arg{ip_address} ...
}
sub check_network
{
my %arg = validate @_.
{
device => {as 'hostname'},
mac_address => {as 'mac_address'},
timeout => {as 'pos_int', default => 10},
};
# Do something with $arg{device}, $arg{mac_address}, $arg{timeout} ...
}

This is a library of named checks for use with Params::Validate to validate function and method arguments that should be networky things: domain names, hostnames, IP addresses, or mac addresses. See Params::Validate::Checks for details of the overall system.
The following named checks are supplied by this module. In all cases only the syntax is checked, not that the entity in question actually exists on the network:
domainan internet domain name, such as "123-reg.co.uk"; it must having a known top-level domain (such as ".uk")
hostnamean internet hostname; this includes all domain names but also unqualified hostnames like "www1", which may be valid on internal networks
ip_addressan IP address (version 4), such as "212.100.234.56"
public_ip_addresslike ip_address, but excluding addresses such as "192.168.0.42" which are internal-only, not publicly reachable over the internet
mac_addressthe mac address of a network device, such as "00:0E:35:17:F3:4E"
Feedback is welcome on further checks that should be added.


Written and maintained by Smylers <smylers@cpan.org>
Thanks to the authors and maintainers of the above modules that are doing the actual syntax checks.

Copyright 2006-2008 by Smylers.
This library is software libre; you may redistribute it and modify it under the terms of any of these licences: