Subject: | Validate::Net |
Date: | Mon, 11 Jun 2007 04:35:09 -0700 (PDT) |
To: | bug-Validate-Net [...] rt.cpan.org, cpan [...] ali.as |
From: | Matti Linnanvuori <mattilinnanvuori [...] yahoo.com> |
I attach a patch to allow alphanumeric Unicode characters in arbitrary order in method domain in Validate::Net.
Index: C:/Documents and Settings/malinnanvuori/My Documents/gbui/trunk/src/Gb/Ext/Validate/Net.pm
===================================================================
--- C:/Documents and Settings/malinnanvuori/My Documents/gbui/trunk/src/Gb/Ext/Validate/Net.pm (revision 1067)
+++ C:/Documents and Settings/malinnanvuori/My Documents/gbui/trunk/src/Gb/Ext/Validate/Net.pm (revision 7032)
@@ -95,8 +95,8 @@
my $self = shift->_self;
my $domain = lc shift or return undef;
- # Do a quick check for any invalid characters, or basic problems
- if ( $domain =~ /[^a-z0-9\.-]/ ) {
+ # Do a quick check for any invalid characters, or basic problems
+ if ( $domain =~ /[^[\p{IsAlnum}]\.-]/ ) {
return $self->withReason( "Domain '$domain' contains invalid characters" );
}
if ( $domain =~ /\.\./ ) {
@@ -119,23 +119,15 @@
return $self->withReason( "Domain section '$element' cannot be longer than 63 characters" );
}
- # Segments are allowed to contain only digits
- next if $element =~ /^\d+$/;
-
- # Segment must start with a letter
- if ( $element !~ /^[a-z]/ ) {
- return $self->withReason( "Domain section '$element' must start with a letter" );
+ # Segment must start with a letter or a digit
+ if ( $element !~ /^[\p{IsAlnum}]/ ) {
+ return $self->withReason( "Domain section '$element' must start with a letter or number" );
}
# Segment must end with a letter or number
- if ( $element !~ /[a-z0-9]$/ ) {
+ if ( $element !~ /[\p{IsAlnum}]$/ ) {
return $self->withReason( "Domain section '$element' must end with a letter or number" );
}
-
- # Cannot have two consecutive dashes ( RFC doesn't say so that I can find... is this correct? )
- if ( $element =~ /--/ ) {
- return $self->withReason( "Domain sections '$element' cannot have two dashes in a row" );
- }
}
return 1 if $self->{depth} eq 'fast';
__________________________________ Yahoo! Clever: Sie haben Fragen? Yahoo! Nutzer antworten Ihnen. www.yahoo.de/clever