dos-djgpp update (from Laszlo Molnar <laszlo.molnar@eth.ericsson.se>)
[p5sagit/p5-mst-13.2.git] / pod / pod2usage.PL
index f534252..adf49bd 100644 (file)
@@ -2,6 +2,7 @@
 
 use Config;
 use File::Basename qw(&basename &dirname);
+use Cwd;
 
 # List explicitly here the variables you want Configure to
 # generate.  Metaconfig only looks for shell variables, so you
@@ -10,11 +11,14 @@ use File::Basename qw(&basename &dirname);
 #  $startperl
 # to ensure Configure will look for $Config{startperl}.
 
-$file = basename($0);
-$file =~ s/\.PL$//i;
-$file .= '.com' if $^O eq 'VMS';
+# This forces PL files to create target in same directory as PL file.
+# This is so that make depend always knows where to find PL derivatives.
+$origdir = cwd;
+chdir(dirname($0));
+($file = basename($0)) =~ s/\.PL$//;
+$file =~ s/\.pl$//
+        if ($^O eq 'VMS' or $^O eq 'os2' or $^O eq 'dos');  # "case-forgiving"
 
-chdir("pod") or die "Can't chdir to pod: $!";
 open OUT,">$file" or die "Can't create $file: $!";
 
 print "Extracting $file (with variable substitutions)\n";
@@ -175,3 +179,4 @@ pod2usage(\%usage);
 close OUT or die "Can't close $file: $!";
 chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
+chdir $origdir;