Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Fix non-working (in 5.8.x perl) is_ipv4() routine. (split '.' doesn't

  do what you might think it does.)

* Have concerns about efficiency of this and wisdom of using
  this routine for a string which is not being used as an IP address,
  but not suggesting change. I guess CPUs are getting faster.
  • Loading branch information...
commit 3394657a9651accaf762c5a8796b588601c509ae 1 parent 38090de
Mike Heins authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/Vend/Util.pm
View
6 lib/Vend/Util.pm
@@ -880,11 +880,11 @@ sub is_hash {
# Verify that passed string is a valid IPv4 address.
sub is_ipv4 {
my $addr = shift or return;
- my @segs = split '.', $addr;
+ my @segs = split /\./, $addr;
return unless @segs == 4;
foreach (@segs) {
- return unless /^\d{1,3}$/ && !/^0\d/;
- return unless $_ <= 255;
+ return unless /^\d{1,3}$/ && !/^0\d/;
+ return unless $_ <= 255;
}
return 1;
}
Please sign in to comment.
Something went wrong with that request. Please try again.