2
###################################################################################
4
# Embperl - Copyright (c) 1997-2004 Gerald Richter / ecos gmbh www.ecos.de
6
# You may distribute under the terms of either the GNU General Public
7
# License or the Artistic License, as specified in the Perl README file.
9
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
10
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13
# $Id: FQDN_IPAddr.pm,v 1.2 2004/01/23 06:50:57 richter Exp $
15
###################################################################################
18
package Embperl::Form::Validate::FQDN_IPAddr ;
20
use base qw(Embperl::Form::Validate::Default);
26
validate_fqdn_ipaddr => 'Feld %0: "%1" ist keine g�ltiger Hostname oder IP-Adresse.',
31
validate_fqdn_ipaddr => 'Field %0: "%1" isn\\\'t a valid hostname or ip-address.',
35
# --------------------------------------------------------------
39
my ($self, $id, $language, $default_language) = @_ ;
41
return $error_messages{$language}{$id} ||
42
$error_messages{$default_language}{$id} ||
43
$self -> SUPER::getmsg ($id, $language, $default_language) ;
47
# --------------------------------------------------------------
51
my ($self, $key, $value, $fdat, $pref) = @_ ;
53
if ($value =~ /^(\d+)\.(\d+).(\d+)\.(\d+)$/)
55
if ($1 < 0 || $1 > 255 ||
68
return undef if ($value =~ /^[-.a-zA-Z0-9]+$/) ;
69
return ['validate_fqdn_ipaddr', $value] ;
72
# --------------------------------------------------------------
74
sub getscript_validate
76
my ($self, $arg, $pref) = @_ ;
78
return ('obj.value.search(/^[-.a-zA-Z0-9]+$/) >= 0 ', ['validate_fqdn_ipaddr', "'+obj.value+'"]) ;