X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fcheckpods.PL;h=92b7ae6e4c1272d13f45a33ae7c52d08e2ec6449;hb=c9d5ac959cdfa7a668b3bfbbc2b56923c316ef43;hp=25d1f18fb6a85d01225ab4f577d4679406b231a6;hpb=f31caa6397878e551e5e10cf6cc29a61769fd5fd;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/checkpods.PL b/pod/checkpods.PL index 25d1f18..92b7ae6 100644 --- a/pod/checkpods.PL +++ b/pod/checkpods.PL @@ -2,6 +2,7 @@ use Config; use File::Basename qw(&basename &dirname); +use Cwd; # List explicitly here the variables you want Configure to # generate. Metaconfig only looks for shell variables, so you @@ -12,11 +13,10 @@ use File::Basename qw(&basename &dirname); # This forces PL files to create target in same directory as PL file. # This is so that make depend always knows where to find PL derivatives. -chdir(dirname($0)); -($file = basename($0)) =~ s/\.PL$//; -$file =~ s/\.pl$// - if ($Config{'osname'} eq 'VMS' or - $Config{'osname'} eq 'OS2'); # "case-forgiving" +$origdir = cwd; +chdir dirname($0); +$file = basename($0, '.PL'); +$file .= '.com' if $^O eq 'VMS'; open OUT,">$file" or die "Can't create $file: $!"; @@ -26,9 +26,9 @@ print "Extracting $file (with variable substitutions)\n"; # You can use $Config{...} to use Configure variables. print OUT <<"!GROK!THIS!"; -$Config{'startperl'} - eval 'exec perl -S \$0 "\$@"' - if 0; +$Config{startperl} + eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' + if \$running_under_some_shell; !GROK!THIS! # In the following, perl variables are not expanded during extraction. @@ -39,7 +39,7 @@ print OUT <<'!NO!SUBS!'; # From: Roderick Schertler # To: perl5-porters@africa.nicoh.com # Subject: POD lines with only spaces -# +# # There are some places in the documentation where a POD directive is # ignored because the line before it contains whitespace (and so the # directive doesn't start a paragraph). This patch adds a way to check @@ -55,16 +55,26 @@ print OUT <<'!NO!SUBS!'; # to grow. Someone will probably want to rewrite in terms of # some sort of Pod::Checker module. Or something. Consider this # a placeholder for the future. -$exit = $last_blank = 0; +# Version 1.02 Roderick Schertler +# Check for pod directives following any kind of unempty line, not +# just lines of whitespace. + +@directive = qw(head1 head2 item over back cut pod for begin end); +@directive{@directive} = (1) x @directive; + +$exit = $last_unempty = 0; while (<>) { - chop; - if (/^(=\S+)/ && $last_blank) { - printf "%s: line %5d, Non-empty line preceeding directive %s\n", + chomp; + if (/^=(\S+)/ && $directive{$1} && $last_unempty) { + printf "%s: line %5d, no blank line preceeding directive =%s\n", $ARGV, $., $1; $exit = 1; } - $last_blank = /^\s+$/; - close(ARGV) if eof; + $last_unempty = ($_ ne ''); + if (eof) { + close(ARGV); + $last_unempty = 0; + } } exit $exit !NO!SUBS! @@ -72,3 +82,4 @@ exit $exit close OUT or die "Can't close $file: $!"; chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; +chdir $origdir;