From 8c74b979583bfd18eeb2e2262c751cdb42c85f00 Mon Sep 17 00:00:00 2001
From: joey <joey>
Date: Wed, 8 Nov 2000 00:35:15 +0000
Subject: [PATCH] r385:    * Fixed dh_perl to work with perl 5.6, Closes:
 #76508

---
 debian/changelog |  6 ++++++
 dh_perl          | 26 +++++++++++++++-----------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 39380a1..8113923 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+debhelper (2.1.22) unstable; urgency=low
+
+  * Fixed dh_perl to work with perl 5.6, Closes: #76508
+
+ -- Joey Hess <joeyh@debian.org>  Tue,  7 Nov 2000 15:56:54 -0800
+
 debhelper (2.1.21) unstable; urgency=low
 
   * dh_movefiles: no longer does the symlink ordering hack, as
diff --git a/dh_perl b/dh_perl
index a3372d5..eb69a75 100755
--- a/dh_perl
+++ b/dh_perl
@@ -11,11 +11,15 @@ my $lib_dir = 'usr/lib/perl5';
 
 # Figure out the version of perl. If $ENV{PERL} is set, query the perl binary
 # it points to, otherwise query perl directly.
-my $version=sprintf("%.3f", $]);
+#
+# This is pretty gawd-aweful ugly, because we need "5.00[45]"
+# and "5.[6789]" to be returned depending on perl version.
+my $version;
 if (defined $ENV{PERL}) {
-	# This is pretty gawd-aweful ugly, because we need "5.00[45]"
-	# and "5.[6789]" to be returned.
-	$version=`$ENV{PERL} -e '\$] < 5.006 ? printf "%.3f", \$] : printf "%vd\n", substr \$^V, 0, -1'`;
+	$version=`$ENV{PERL} -e '\$] < 5.006 ? printf "%.3f", \$] : printf "%vd", substr \$^V, 0, -1'`;
+}
+else {
+	$version=$] < 5.006 ? sprintf "%.3f", $] : sprintf "%vd", substr $^V, 0, -1;
 }
 
 # Cleaning the paths given on the command line
@@ -48,13 +52,13 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
 	if ($dirs) {
 	    foreach $file (split(/\n/,`find $dirs -type f \\( -name "*.pm" -or -name "*.so" \\)`)) {
 	        $found++;
-		if ($file =~ m<^$TMP/$re/(\d\.\d{3})/([^/]+)/>) {
+		if ($file =~ m<^$TMP/$re/(\d\.\d+)/([^/]+)/>) {
 			$v = $1;
 			$arch = $2;
 			check_module_version ($v, $version);
 			$v .= '-thread' if ($arch =~ /-thread/); 
 			$dep_arch = add_deps ($dep_arch, "perl-$v");
-		} elsif ($file =~ m<^$TMP/$re/(\d.\d{3})/>) {
+		} elsif ($file =~ m<^$TMP/$re/(\d.\d+)/>) {
 			$v = $1;
 			check_module_version ($v, $version);
 			$dep_arch = add_deps ($dep_arch, "perl-$v");
@@ -110,14 +114,14 @@ sub add_deps {
 	my ($dep, $new) = @_;
 	
         # If the $new-base package can exist then add $ext to $new
-	$new = "$new$ext" if ($new =~ m/^(?:perl5|perl-\d\.\d{3})$/);
+	$new = "$new$ext" if ($new =~ m/^(?:perl5|perl-\d\.\d+)$/);
 	
 	# If $new = perl5 or perl5-thread check if perl-X.XXX(-thread)?
 	# is not already in the dependencies
 	if ($new eq "perl5") {
-		return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}(\s|,|$)/);
+		return $dep if ($dep =~ m/(^|\s)perl-5\.\d+(\s|,|$)/);
 	} elsif ($new eq "perl5-thread") {
-		return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}-thread(\s|,|$)/);
+		return $dep if ($dep =~ m/(^|\s)perl-5\.\d+-thread(\s|,|$)/);
 	}
 	
 	if (not $dep) {
@@ -148,9 +152,9 @@ sub dep_from_script {
 			$dep = "perl5";
 		} elsif ($perl eq "perl-thread") {
 			$dep = "perl5-thread";
-		} elsif ($perl =~ m/^perl-\d\.\d{3}(?:-thread)?$/) {
+		} elsif ($perl =~ m/^perl-\d\.\d+(?:-thread)?$/) {
 			$dep = $perl;
-		} elsif ($perl =~ m/^perl(\d\.\d{3})(\d\d)$/) {
+		} elsif ($perl =~ m/^perl(\d\.\d+)(\d\d)$/) {
 			# Should never happen but ...
 			$dep = "perl-$1 (=$1.$2)";
 		}
-- 
2.39.5