[MacPerl-Porters] [PATCH] DosGlob.t for MacPerl 5.7.3/5.8.0

[email protected] (Thomas Wegner) Thu, 30 May 2002 18:50:52 +0200
Newsgroups perl.macperl.porters
Message-ID <p04320400b91c05185b3d@[149.225.13.104]>
Hi,

here's a patch for DosGlob.t (MacPerl 5.7.3/5.8.0). Now happy again on Mac OS.


diff -ru DosGlob.t.orig DosGlob.t
--- DosGlob.t.orig	Thu May 30 18:42:53 2002
+++ DosGlob.t	Thu May 30 18:45:56 2002
@@ -21,7 +21,6 @@
  } else {
      $expected = $_ = "op/a*.t";
  }
-$_ = "op/a*.t";
  my @r = glob;
  print "not " if $_ ne $expected;
  print "ok 1\n";
@@ -94,7 +93,8 @@
  package Foo;
  use File::DosGlob 'glob';
  @s = ();
-while (glob '*/a*.t') {
+$pat = ($^O eq 'MacOS') ? ':*:a*.t' : '*/a*.t';
+while (glob ($pat)) {
      print "# $_\n";
      push @s, $_;
  }
@@ -103,15 +103,28 @@

  # test if different glob ops maintain independent contexts
  @s = ();
-while (<*/a*.t>) {
-    my $i = 0;
-    print "# $_ <";
-    push @s, $_;
-    while (<*/b*.t>) {
-        print " $_";
-	$i++;
-    }
-    print " >\n";
+if ($^O eq 'MacOS') {
+	while (<:*:a*.t>) {
+    	my $i = 0;
+    	print "# $_ <";
+    	push @s, $_;
+    	while (<:*:b*.t>) {
+        	print " $_";
+		$i++;
+    	}
+    	print " >\n";
+	}
+} else {
+	while (<*/a*.t>) {
+    	my $i = 0;
+    	print "# $_ <";
+    	push @s, $_;
+    	while (<*/b*.t>) {
+        	print " $_";
+		$i++;
+    	}
+    	print " >\n";
+	}
  }
  print "not " if "@r" ne "@s";
  print "ok 9\n";
@@ -121,15 +134,28 @@
  use File::DosGlob 'GLOBAL_glob';
  package Bar;
  @s = ();
-while (<*/a*.t>) {
-    my $i = 0;
-    print "# $_ <";
-    push @s, $_;
-    while (glob '*/b*.t') {
+if ($^O eq 'MacOS') {
+	while (<:*:a*.t>) {
+    	my $i = 0;
+    	print "# $_ <";
+   	 	push @s, $_;
+    	while (glob ':*:b*.t') {
          print " $_";
-	$i++;
-    }
-    print " >\n";
+		$i++;
+    	}
+    	print " >\n";
+	}
+} else {
+	while (<*/a*.t>) {
+    	my $i = 0;
+    	print "# $_ <";
+   	 	push @s, $_;
+    	while (glob '*/b*.t') {
+        print " $_";
+		$i++;
+    	}
+    	print " >\n";
+	}
  }
  print "not " if "@r" ne "@s";
  print "ok 10\n";


__END__ of patch


Best regards,

--Thomas