Efficiency patchlet for pp_aassign()
[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);
5
6# List explicitly here the variables you want Configure to
7# generate. Metaconfig only looks for shell variables, so you
8# have to mention them as if they were shell variables, not
9# %Config entries. Thus you write
10# $startperl
11# to ensure Configure will look for $Config{startperl}.
12
13# This forces PL files to create target in same directory as PL file.
14# This is so that make depend always knows where to find PL derivatives.
44a8e56a 15chdir dirname($0);
16$file = basename($0, '.PL');
f31caa63 17
18open OUT,">$file" or die "Can't create $file: $!";
19
20print "Extracting $file (with variable substitutions)\n";
21
22# In this section, perl variables will be expanded during extraction.
23# You can use $Config{...} to use Configure variables.
24
25print OUT <<"!GROK!THIS!";
5f05dabc 26$Config{startperl}
27 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
28 if \$running_under_some_shell;
f31caa63 29!GROK!THIS!
30
31# In the following, perl variables are not expanded during extraction.
32
33print OUT <<'!NO!SUBS!';
34# From roderick@gate.netThu Sep 5 17:19:30 1996
35# Date: Thu, 05 Sep 1996 00:11:22 -0400
36# From: Roderick Schertler <roderick@gate.net>
37# To: perl5-porters@africa.nicoh.com
38# Subject: POD lines with only spaces
39#
40# There are some places in the documentation where a POD directive is
41# ignored because the line before it contains whitespace (and so the
42# directive doesn't start a paragraph). This patch adds a way to check
43# for these to the pod Makefile (though it isn't made part of the build
44# process, which would be a good idea), and fixes those places where the
45# problem currently exists.
46#
47# Version 1.00 Original.
48# Version 1.01 Andy Dougherty <doughera@lafcol.lafayette.edu>
49# Trivial modifications to output format for easier auto-parsing
50# Broke it out as a separate function to avoid nasty
51# Make/Shell/Perl quoting problems, and also to make it easier
52# to grow. Someone will probably want to rewrite in terms of
53# some sort of Pod::Checker module. Or something. Consider this
54# a placeholder for the future.
55$exit = $last_blank = 0;
56while (<>) {
57 chop;
58 if (/^(=\S+)/ && $last_blank) {
59 printf "%s: line %5d, Non-empty line preceeding directive %s\n",
60 $ARGV, $., $1;
61 $exit = 1;
62 }
63 $last_blank = /^\s+$/;
64 close(ARGV) if eof;
65}
66exit $exit
67!NO!SUBS!
68
69close OUT or die "Can't close $file: $!";
70chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
71exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';