Subject: | Hybrid mode doesn't allow wildcarding |
From the documentation for Regexp::Common::DNS 0.00_01:
"By default this regexp uses a pragmatic combination of rfc1035, and
rfc2181. This is intended to be in sprit with current DNS operation
practices. This hybrid approach is simlar to rfc1035, but allows for
underscores, and for underscores and hyphens to begin or end a lable.
It also allows for wilcarding."
However, the attached test case demonstrates that the default hybrid
approach does not allow wildcarding.
Tested with two configurations:
Perl 5.8.7 & DNS::Regexp::Common 0.00_01 on Solaris 9
Perl 5.8.8 & DNS::Regexp::Common 0.00_01 on Linux 2.6
My suggestion would be to change the documentation, not the code, but
either way works for me as long as the two agree.
The easy workaround is to just always specify the desired behavior for
the wildcard flag.
Subject: | wildcard-test.pl |
#!/usr/bin/perl
use warnings;
use strict;
use Regexp::Common qw( dns );
my $WILDCARD_DOMAIN = '*.example.com';
if ($WILDCARD_DOMAIN =~ $RE{'dns'}{'domain'}) {
print "Default regexp MATCHED '$WILDCARD_DOMAIN'\n";
}
else {
print "Default regexp DID NOT match '$WILDCARD_DOMAIN'\n";
}