buildtoc - fix a bug and add some comments
authorDavid Mitchell <davem@iabyn.com>
Wed, 18 May 2011 15:43:50 +0000 (16:43 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 18 May 2011 15:43:50 +0000 (16:43 +0100)
while(readdir) doesn't auto-assign to $_

Also, make the informative output clear that its telling you like of files
it will be processing, rather than that its actually processing it now.

pod/buildtoc

index 3b61619..bfc39da 100644 (file)
@@ -54,6 +54,8 @@ foreach (values %Targets) {
   $_ = abs_from_top($_);
 }
 
+# process command-line switches
+
 {
   my @files = keys %Targets;
   my $filesopts = join(" | ", map { "--build-$_" } "all", sort @files);
@@ -101,9 +103,12 @@ __USAGE__
      );
 
 if ($Verbose) {
-  print "I'm building $_\n" foreach keys %Build;
+  print "I will be building $_\n" foreach keys %Build;
 }
 
+
+# process pod.lst
+
 open my $master, '<', $masterpodfile or die "$0: Can't open $masterpodfile: $!";
 
 my ($delta_source, $delta_target);
@@ -188,7 +193,7 @@ close $master;
   }
 
   opendir my $dh, abs_from_top('pod/');
-  while (readdir $dh) {
+  while (defined ($_ = readdir $dh)) {
     next unless /\.pod\z/;
     push @disk_pods, $_;
     ++$disk_pods{$_};