use strict;
use vars qw($masterpodfile %Build %Targets $Verbose $Quiet %Ignore
- @Master %Readmes %Pods %Aux %Readmepods %Pragmata %Modules
+ @Master %Readmes %Pods %Aux %Pragmata %Modules $delta_target
%Copies %Generated $Test);
use File::Spec;
use File::Find;
no locale;
require 5.010;
+# Assumption is that we're either already being run from the top level (*nix,
+# VMS), or have absolute paths in @INC (Win32, pod/Makefile)
{
my $Top = File::Spec->catdir($FindBin::Bin, File::Spec->updir);
-
- 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);
- }
+ chdir $Top or die "Can't chdir to $Top: $!";
}
# make it clearer when we haven't run to completion, as we can be quite
}
-$masterpodfile = abs_from_top('pod.lst');
+$masterpodfile = 'pod.lst';
# Generate any/all of these files
# --verbose gives slightly more output
# TODO: add roffitall
);
-foreach (values %Targets) {
- $_ = abs_from_top($_);
-}
-
# process command-line switches
{
print "I will be building $_\n" foreach keys %Build;
}
-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>;
}
# process pod.lst
+{
+ my %Readmepods;
open my $master, '<', $masterpodfile or my_die "Can't open $masterpodfile: $!";
close $master;
# Sanity cross check
-{
+
my (%disk_pods, @disk_pods);
my (@manipods, %manipods);
my (@manireadmes, %manireadmes);
my (@cpanpods, %cpanpods, %cpanpods_short);
my (%our_pods);
+ # These are stub files for deleted documents. We don't want them to show up
+ # in perl.pod, they just exist so that if someone types "perldoc perltoot"
+ # they get some sort of pointer to the new docs.
+ my %ignoredpods
+ = map { ( "$_.pod" => 1 ) } qw( perlboot perlbot perltooc perltoot );
+
# Convert these to a list of filenames.
foreach (keys %Pods, keys %Readmepods) {
$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, $_;
# 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;
@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 /) {
push @inconsistent, "$0: $i exists but is unknown by ../MANIFEST\n"
if !$manipods{$i} && !$manireadmes{$i} && !$Copies{$i} && !$Generated{$i} && !$cpanpods{$i};
push @inconsistent, "$0: $i exists but is unknown by perl.pod\n"
- if !$perlpods{$i} && !exists $Copies{$i} && !$cpanpods{$i};
+ if !$perlpods{$i} && !exists $Copies{$i} && !$cpanpods{$i} && !$ignoredpods{$i};
}
my %BuildFiles;
foreach my $path (values %Build) {
# Find all the modules
if ($Build{toc}) {
my @modpods;
- find \&getpods => abs_from_top('lib/');
+ find \&getpods => 'lib';
sub getpods {
if (/\.p(od|m)$/) {
# 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(@$_);
}