Issue useful diagnostic on unknown pod commands.
authorAbigail <abigail@abigail.be>
Thu, 31 Aug 2000 03:41:18 +0000 (23:41 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 31 Aug 2000 13:38:48 +0000 (13:38 +0000)
Subject: [PATCH lib/Pod/Man.pm] Re: [ID 20000830.048]
Message-ID: <20000831074118.24880.qmail@foad.org>

p4raw-id: //depot/perl@6940

lib/Pod/Man.pm

index b49e184..7c71681 100644 (file)
@@ -462,7 +462,18 @@ sub command {
     return if $command eq 'pod';
     return if ($$self{EXCLUDE} && $command ne 'end');
     $command = 'cmd_' . $command;
-    $self->$command (@_);
+    unless ($self -> can ($command)) {
+        my $com = substr $command => 4;
+        my ($file, $line) = $_ [2] -> file_line;
+       (my $text = $_ [0]) =~ s/\n+\z//g;
+        $text = " $text" if $text =~ /^\S/;
+        warn qq {$file: Unknown command paragraph "=$com${text}"},
+             qq { on line $line.\n};
+        return;
+    }
+    else {
+        $self->$command (@_);
+    }
 }
 
 # Called for a verbatim paragraph.  Gets the paragraph, the line number, and
@@ -1162,6 +1173,11 @@ know about.  C<EE<lt>%sE<gt>> was printed verbatim in the output.
 (W) The POD source contained a non-standard interior sequence (something of
 the form C<XE<lt>E<gt>>) that Pod::Man didn't know about.  It was ignored.
 
+=item %s: Unknown command paragraph "%s" on line %d.
+
+(W) The POD source contained a non-standard command paragraph (something of
+the form C<=command args>) that Pod::Man didn't know about. It was ignored.
+
 =item Unmatched =back
 
 (W) Pod::Man encountered a C<=back> command that didn't correspond to an