From e6679c0eb25148c5261dbf03acacd6ded48cecac Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Mon, 25 Nov 2002 17:07:33 +0000 Subject: added is_domain_name that checks validity of a domain name. --- perl-install/network/network.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'perl-install') diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 1594aba32..55d5c324b 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -221,6 +221,11 @@ sub is_ip { return if grep { $_ < 0 || $_ > 255 } @fields; @fields; } +sub is_domain_name { + my ($name) = @_; + my @fields = split /\./, $name; + $name !~ /\.$/ && @fields > 0 && @fields == grep { /^[[:alnum:]](?:[\-[:alnum:]]{0,61}[[:alnum:]])?$/ } @fields; +} sub netmask { my ($ip) = @_; -- cgit v1.2.1