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

Mike Heins <[email protected]>
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
commit 3394657a9651accaf762c5a8796b588601c509ae
Author: Mike Heins <[email protected]>
Date:   Sun Feb 9 08:49:17 2014 -0500

    * 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.

 lib/Vend/Util.pm |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/lib/Vend/Util.pm b/lib/Vend/Util.pm
index a8a2683..2152bad 100644
--- a/lib/Vend/Util.pm
+++ b/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;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.