Refactor the code for determining where an extension is on disk.
authorNicholas Clark <nick@ccl4.org>
Wed, 30 Sep 2009 09:46:05 +0000 (10:46 +0100)
committerNicholas Clark <nick@ccl4.org>
Wed, 30 Sep 2009 09:46:05 +0000 (10:46 +0100)
make_ext.pl

index 7734bf5..56af041 100644 (file)
@@ -242,23 +242,22 @@ foreach my $spec (@extspec)  {
     my $mname = $spec;
     $mname =~ s!/!::!g;
     my $ext_pathname;
-    if (-d "ext/$spec"
-       # Temporary hack to cope with smokers that are not clearing directories:
-       && $spec =~ m!/!
-       ) {
-       # Old style ext/Data/Dumper/
-       $ext_pathname = "ext/$spec";
-    } else {
-       # New style ext/Data-Dumper/
-       my $copy = $spec;
-       $copy =~ tr!/!-!;
-       foreach my $dir (@ext_dirs) {
-           if (-d "$dir/$copy") {
-               $ext_pathname = "$dir/$copy";
-               last;
-           }
+
+    # Try new style ext/Data-Dumper/ first
+    my $copy = $spec;
+    $copy =~ tr!/!-!;
+    foreach my $dir (@ext_dirs) {
+       if (-d "$dir/$copy") {
+           $ext_pathname = "$dir/$copy";
+           last;
        }
-       if (!defined $ext_pathname) {
+    }
+
+    if (!defined $ext_pathname) {
+       if (-d "ext/$spec") {
+           # Old style ext/Data/Dumper/
+           $ext_pathname = "ext/$spec";
+       } else {
            warn "Can't find extension $spec in any of @ext_dirs";
            next;
        }