From b86390b797ae3a5bc44a327bdeddb09c86209c95 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Fri, 21 Oct 2011 13:10:10 -0500
Subject: [PATCH] Enforce Socket6 0.23 dependency through Makefile.PL if
installed. Enhance eval code to fail if version 0.23 of
Socket6 is not installed
---
IP.pm | 2 +-
Lite/Makefile.PL | 8 +++++++
Lite/Util/Util.pm | 2 +-
Lite/Util/lib/NetAddr/IP/InetBase.pm | 2 +-
META.yml | 36 +++++++++++++++++++++------------
Makefile.PL | 8 +++++++
6 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/IP.pm b/IP.pm
index 935676e..1a198b1 100644
--- a/IP.pm
+++ b/IP.pm
@@ -35,7 +35,7 @@ require Exporter;
@ISA = qw(Exporter NetAddr::IP::Lite);
-$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.49 $ =~ /\d+/g) };
+$VERSION = " 4.049_01";
=pod
diff --git a/Lite/Makefile.PL b/Lite/Makefile.PL
index 3fce927..577f38d 100644
--- a/Lite/Makefile.PL
+++ b/Lite/Makefile.PL
@@ -39,4 +39,12 @@ README : |. $module .q|
|;
}
+# Force an upgrade of Socket6 to 0.23 if it's installed but downlevel. Socket6 is not a hard dependency for this module.
+if(eval { require Socket6 } && $Socket6::VERSION < 0.23 ) {
+ $makeparms{'PREREQ_PM'}->{'Socket6'} = 0.23;
+} else {
+ # Encourage Socket6 if the user wants to install it.
+ $makeparms{'META_MERGE'}->{'recommends'}->{'Socket6'} = 0.23;
+}
+
WriteMakefile(%makeparms);
diff --git a/Lite/Util/Util.pm b/Lite/Util/Util.pm
index 774aff8..97c7535 100644
--- a/Lite/Util/Util.pm
+++ b/Lite/Util/Util.pm
@@ -226,7 +226,7 @@ sub _end_gethostbyname {
return @rv;
}
-unless ( eval { require Socket6 }) {
+unless ( eval { require Socket6 } && $Socket6::VERSION > 0.22 ) {
$mygethostbyname = sub {
my @tip = gethostbyname($_[0]);
return &_end_gethostbyname(@tip);
diff --git a/Lite/Util/lib/NetAddr/IP/InetBase.pm b/Lite/Util/lib/NetAddr/IP/InetBase.pm
index 1d1fe1b..a13bd31 100644
--- a/Lite/Util/lib/NetAddr/IP/InetBase.pm
+++ b/Lite/Util/lib/NetAddr/IP/InetBase.pm
@@ -80,7 +80,7 @@ if (eval { AF_INET6() } ) {
*AF_INET6 = \&Socket::AF_INET6;
$emulateAF_INET6 = -1; # have it, remind below
}
-if (eval{ require Socket6 } ) {
+if (eval{ require Socket6 } && $Socket6::VERSION > 0.22 ) {
if ($emulateAF_INET6) {
import Socket6 qw(
inet_pton
diff --git a/META.yml b/META.yml
index b1fd991..a6ffb02 100644
--- a/META.yml
+++ b/META.yml
@@ -1,14 +1,24 @@
---- #YAML:1.0
-name: NetAddr-IP
-version: 4.049
-abstract: Manages IPv4 and IPv6 addresses and subnets
-license: ~
-author:
- - Luis E. Muñoz <luismunoz@cpan.org>, Michael Robinton <miker@cpan.org>
-generated_by: ExtUtils::MakeMaker version 6.42
-distribution_type: module
-requires:
- Test::More: 0
+---
+abstract: 'Manages IPv4 and IPv6 addresses and subnets'
+author:
+ - 'Luis E. Muñoz <luismunoz@cpan.org>, Michael Robinton <miker@cpan.org>'
+build_requires:
+ ExtUtils::MakeMaker: 0
+configure_requires:
+ ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.59, CPAN::Meta::Converter version 2.112150'
+license: unknown
meta-spec:
- url:
http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url:
http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: NetAddr-IP
+no_index:
+ directory:
+ - t
+ - inc
+recommends:
+ Socket6: 0.23
+requires:
+ Test::More: 0
+version: 4.049_01
diff --git a/Makefile.PL b/Makefile.PL
index 76baad9..9db0892 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -125,4 +125,12 @@ my %makeparms = (
clean => { FILES => "*~ tmp*"},
);
+# Force an upgrade of Socket6 to 0.23 if it's installed but downlevel. Socket6 is not a hard dependency for this module.
+if(eval { require Socket6 } && $Socket6::VERSION < 0.23 ) {
+ $makeparms{'PREREQ_PM'}->{'Socket6'} = 0.23;
+} else {
+ # Encourage Socket6 if the user wants to install it.
+ $makeparms{'META_MERGE'}->{'recommends'}->{'Socket6'} = 0.23;
+}
+
WriteMakefile(%makeparms);
--
1.7.5.4