summaryrefslogtreecommitdiff
path: root/configpm
diff options
context:
space:
mode:
authorYves Orton <yves.orton@booking.com>2014-01-31 20:54:54 +0800
committerYves Orton <yves.orton@booking.com>2014-01-31 20:55:36 +0800
commit8b4a1c96a99236cf05ec1932866aa67135dc76b9 (patch)
tree6c8d176e99a68fa173618fe5b2e8968c3a992467 /configpm
parenta6d9d24474ff556123b72da8ccd6d21d5bc63fcd (diff)
downloadperl-8b4a1c96a99236cf05ec1932866aa67135dc76b9.tar.gz
Make configpm produce better diagnostics for malformed glossary entries
Patch 8b6a017ccef7126ae5bcac137fa9a45de4f2c155 added some malformed entries to Porting/Glossary. (The entries were missing a trailing colon). These malformed entries would produce a cryptic one-line warning, but only when various files were being regenerated. To make things more difficult these warnings would be produced at the top of, or in the middle of a large stream of other compilation actions, easily allowing one to overlook them. Even if you noticed them the information provided did not make it particularly easy to figure out what was wrong. This patch changes things so that the warnings contain more information, it also causes configpm to die, and thus break the build process, once it finishes scanning the glossary if there were any warnings during processing. This allows us to avoid whackamole when dealing with multiple broken entries, and makes it painfully obvious if there are issues processing the glossary file, which should prevent any future repeat of the errors in 8b6a017ccef7126.
Diffstat (limited to 'configpm')
-rwxr-xr-xconfigpm12
1 files changed, 11 insertions, 1 deletions
diff --git a/configpm b/configpm
index a8a8ca1226..d5bf5f26a8 100755
--- a/configpm
+++ b/configpm
@@ -974,6 +974,7 @@ if ($Opts{glossary}) {
my %seen = ();
my $text = 0;
$/ = '';
+my $errors= 0;
sub process {
if (s/\A(\w*)\s+\(([\w.]+)\):\s*\n(\t?)/=item C<$1>\n\nFrom F<$2>:\n\n/m) {
@@ -998,7 +999,9 @@ EOF
}
elsif (!$text || !/\A\t/) {
warn "Expected a Configure variable header",
- ($text ? " or another paragraph of description" : () );
+ ($text ? " or another paragraph of description" : () ),
+ ", instead we got:\n$_";
+ $errors++;
}
s/n't/n\00t/g; # leave can't, won't etc untouched
s/^\t\s+(.*)/\n$1/gm; # Indented lines ===> new paragraph
@@ -1035,6 +1038,13 @@ if ($Opts{glossary}) {
process;
print CONFIG_POD;
}
+ if ($errors) {
+ die "Errors encountered while processing $Glossary. ",
+ "Header lines are expected to be of the form:\n",
+ "NAME (CLASS):\n",
+ "Maybe there is a malformed header?\n",
+ ;
+ }
}
print CONFIG_POD <<'ENDOFTAIL';