diff options
author | Graham Barr <gbarr@pobox.com> | 2003-09-25 09:20:10 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2003-09-25 09:20:10 +0000 |
commit | ce09c12b3449b9120c3ff5c71f54447eeb1be0a4 (patch) | |
tree | c6c63bd7a2480c4c6515158dfd34bebf6886555d | |
parent | 41c2faab2107b1ab674049e161b149c9997f4d62 (diff) | |
download | perl-libnet-ce09c12b3449b9120c3ff5c71f54447eeb1be0a4.tar.gz |
Net::Domain
- Avoid infinite loop
-rw-r--r-- | Net/Domain.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Net/Domain.pm b/Net/Domain.pm index c213ce9..40ad2a8 100644 --- a/Net/Domain.pm +++ b/Net/Domain.pm @@ -16,7 +16,7 @@ use Net::Config; @ISA = qw(Exporter); @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname); -$VERSION = "2.18"; # $Id: //depot/libnet/Net/Domain.pm#20 $ +$VERSION = "2.19"; # $Id: //depot/libnet/Net/Domain.pm#21 $ my($host,$domain,$fqdn) = (undef,undef,undef); @@ -174,9 +174,10 @@ sub _hostdomain { if(defined $dom) { my @h = (); + $dom =~ s/^\.+//; while(length($dom)) { push(@h, "$host.$dom"); - $dom =~ s/^[^.]+.//; + $dom =~ s/^[^.]+.+// or last; } unshift(@hosts,@h); } @@ -336,6 +337,6 @@ it under the same terms as Perl itself. =for html <hr> -I<$Id: //depot/libnet/Net/Domain.pm#20 $> +I<$Id: //depot/libnet/Net/Domain.pm#21 $> =cut |