extra code in pp_concat, Take 2
[p5sagit/p5-mst-13.2.git] / pod / checkpods.PL
CommitLineData
f31caa63 1#!/usr/local/bin/perl
2
3use Config;
4use File::Basename qw(&basename &dirname);
8a5546a1 5use Cwd;
f31caa63 6
7# List explicitly here the variables you want Configure to
8# generate. Metaconfig only looks for shell variables, so you
9# have to mention them as if they were shell variables, not
10# %Config entries. Thus you write
11# $startperl
12# to ensure Configure will look for $Config{startperl}.
13
14# This forces PL files to create target in same directory as PL file.
15# This is so that make depend always knows where to find PL derivatives.
8a5546a1 16$origdir = cwd;
44a8e56a 17chdir dirname($0);
18$file = basename($0, '.PL');
774d564b 19$file .= '.com' if $^O eq 'VMS';
f31caa63 20
21open OUT,">$file" or die "Can't create $file: $!";
22
23print "Extracting $file (with variable substitutions)\n";
24
25# In this section, perl variables will be expanded during extraction.
26# You can use $Config{...} to use Configure variables.
27
28print OUT <<"!GROK!THIS!";
5f05dabc 29$Config{startperl}
30 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
31 if \$running_under_some_shell;
f31caa63 32!GROK!THIS!
33
34# In the following, perl variables are not expanded during extraction.
35
36print OUT <<'!NO!SUBS!';
37# From roderick@gate.netThu Sep 5 17:19:30 1996
38# Date: Thu, 05 Sep 1996 00:11:22 -0400
39# From: Roderick Schertler <roderick@gate.net>
40# To: perl5-porters@africa.nicoh.com
41# Subject: POD lines with only spaces
2862e1b7 42#
f31caa63 43# There are some places in the documentation where a POD directive is
44# ignored because the line before it contains whitespace (and so the
45# directive doesn't start a paragraph). This patch adds a way to check
46# for these to the pod Makefile (though it isn't made part of the build
47# process, which would be a good idea), and fixes those places where the
48# problem currently exists.
49#
50# Version 1.00 Original.
36816da2 51# Version 1.01 Andy Dougherty <doughera@lafayette.edu>
f31caa63 52# Trivial modifications to output format for easier auto-parsing
53# Broke it out as a separate function to avoid nasty
54# Make/Shell/Perl quoting problems, and also to make it easier
55# to grow. Someone will probably want to rewrite in terms of
56# some sort of Pod::Checker module. Or something. Consider this
57# a placeholder for the future.
2862e1b7 58# Version 1.02 Roderick Schertler <roderick@argon.org>
59# Check for pod directives following any kind of unempty line, not
60# just lines of whitespace.
61
62@directive = qw(head1 head2 item over back cut pod for begin end);
63@directive{@directive} = (1) x @directive;
64
65$exit = $last_unempty = 0;
f31caa63 66while (<>) {
8a225eae 67 s/(\012|\015\012|\015)$//;
2862e1b7 68 if (/^=(\S+)/ && $directive{$1} && $last_unempty) {
69 printf "%s: line %5d, no blank line preceeding directive =%s\n",
f31caa63 70 $ARGV, $., $1;
71 $exit = 1;
72 }
2862e1b7 73 $last_unempty = ($_ ne '');
3e3baf6d 74 if (eof) {
75 close(ARGV);
2862e1b7 76 $last_unempty = 0;
3e3baf6d 77 }
f31caa63 78}
79exit $exit
80!NO!SUBS!
81
82close OUT or die "Can't close $file: $!";
83chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
84exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
8a5546a1 85chdir $origdir;