In buildtoc, eliminate abs_from_top() as it now runs from the top level.
authorNicholas Clark <nick@ccl4.org>
Mon, 7 Nov 2011 12:21:12 +0000 (13:21 +0100)
committerNicholas Clark <nick@ccl4.org>
Fri, 18 Nov 2011 10:08:56 +0000 (11:08 +0100)
There's also no need to convert to native path specs, as no paths are passed
to external commands, and the perl runtime on all platforms understands
unambiguously Unix-like paths.

pod/buildtoc

index c0c9a91..57d0ff8 100644 (file)
@@ -20,12 +20,6 @@ require 5.010;
 {
   my $Top = File::Spec->catdir($FindBin::Bin, File::Spec->updir);
   chdir $Top or die "Can't chdir to $Top: $!";
-
-  sub abs_from_top {
-    my $path = shift;
-    return File::Spec->catdir($Top, split /\//, $path) if $path =~ s!/\z!!;
-    return File::Spec->catfile($Top, split /\//, $path);
-  }
 }
 
 # make it clearer when we haven't run to completion, as we can be quite
@@ -39,7 +33,7 @@ sub my_die {
 }
 
 
-$masterpodfile = abs_from_top('pod.lst');
+$masterpodfile = 'pod.lst';
 
 # Generate any/all of these files
 # --verbose gives slightly more output
@@ -64,10 +58,6 @@ $masterpodfile = abs_from_top('pod.lst');
      # TODO: add roffitall
     );
 
-foreach (values %Targets) {
-  $_ = abs_from_top($_);
-}
-
 # process command-line switches
 
 {
@@ -124,7 +114,7 @@ my $delta_target;
 
 {
     my $source = 'perldelta.pod';
-    my $filename = abs_from_top("pod/$source");
+    my $filename = "pod/$source";
     open my $fh, '<', $filename or my_die "Can't open $filename: $!";
     local $/;
     my $contents = <$fh>;
@@ -213,7 +203,7 @@ close $master;
     $our_pods{"$_.pod"}++;
   }
 
-  opendir my $dh, abs_from_top('pod/');
+  opendir my $dh, 'pod';
   while (defined ($_ = readdir $dh)) {
     next unless /\.pod\z/;
     push @disk_pods, $_;
@@ -223,7 +213,7 @@ close $master;
   # Things we copy from won't be in perl.pod
   # Things we copy to won't be in MANIFEST
 
-  my $filename = abs_from_top('MANIFEST');
+  my $filename = 'MANIFEST';
   open my $mani, '<', $filename or my_die "opening $filename failed: $!";
   while (<$mani>) {
     chomp;
@@ -245,7 +235,7 @@ close $master;
   @cpanpods{@cpanpods} = map { s/.*\///r } @cpanpods;
   %cpanpods_short = reverse %cpanpods;
 
-  $filename = abs_from_top('pod/perl.pod');
+  $filename = 'pod/perl.pod';
   open my $perlpod, '<', $filename or my_die "opening $filename failed: $!\n";
   while (<$perlpod>) {
     if (/^For ease of access, /../^\(If you're intending /) {
@@ -305,7 +295,7 @@ close $master;
 # Find all the modules
 if ($Build{toc}) {
   my @modpods;
-  find \&getpods => abs_from_top('lib/');
+  find \&getpods => 'lib';
 
   sub getpods {
     if (/\.p(od|m)$/) {
@@ -385,7 +375,7 @@ EOPOD2B
 
   # All the things in the master list that happen to be pod filenames
   foreach (grep {defined $_ && @$_ == 3 && !$_->[0]{toc_omit}} @Master) {
-    podset($_->[1], abs_from_top($_->[2]));
+    podset(@$_);
   }