Normally (by default) B<Pod::Parser> handles the C<=cut> POD directive
by itself and does not pass it on to the caller for processing. Setting
-this option to non-empty, non-zero value will cause B<Pod::Parser> to
+this option to a non-empty, non-zero value will cause B<Pod::Parser> to
pass the C<=cut> directive to the caller just like any other POD command
(and hence it may be processed by the B<command()> method).
to capture the actual C<=cut> paragraph itself for whatever purpose
it desires.
+=item B<-warnings> (default: unset)
+
+Normally (by default) B<Pod::Parser> recognizes a bare minimum of
+pod syntax errors and warnings and issues diagnostic messages
+for errors, but not for warnings. (Use B<Pod::Checker> to do more
+thorough checking of POD syntax.) Setting this option to a non-empty,
+non-zero value will cause B<Pod::Parser> to issue diagnostics for
+the few warnings it recognizes as well as the errors.
+
=back
Please see L<"parseopts()"> for a complete description of the interface
($rdelim = $ldelim) =~ tr/</>/;
$rdelim =~ s/^(\S+)(\s*)$/$2$1/;
pop @seq_stack;
- my $errmsg = "*** WARNING: unterminated ${cmd}${ldelim}...${rdelim}".
+ my $errmsg = "*** ERROR: unterminated ${cmd}${ldelim}...${rdelim}".
" at line $line in file $file\n";
(ref $errorsub) and &{$errorsub}($errmsg)
or (defined $errorsub) and $self->$errorsub($errmsg)
my %opts = (ref $_[0] eq 'HASH') ? %{ shift() } : ();
my ($in_fh, $out_fh) = @_;
$in_fh = \*STDIN unless ($in_fh);
+ local *myData = $self; ## alias to avoid deref-ing overhead
+ local *myOpts = ($myData{_PARSEOPTS} ||= {}); ## get parse-options
local $_;
## Put this stream at the top of the stack and do beginning-of-input
## See if this line is blank and ends the current paragraph.
## If it isnt, then keep iterating until it is.
- next unless (($textline =~ /^(\s*)$/) && (length $paragraph));
+ next unless (($textline =~ /^([^\S\r\n]*)[\r\n]*$/)
+ && (length $paragraph));
## Issue a warning about any non-empty blank lines
-# XXX avoid warning until Brad has a chance to make this optional --GSAR
-# if (length($1) > 1 and ! $self->{_CUTTING}) {
-# my $errorsub = $self->errorsub();
-# my $file = $self->input_file();
-# $file = VMS::Filespec::unixify($file) if $^O eq 'VMS';
-# my $errmsg = "*** WARNING: line containing nothing but whitespace".
-# " in paragraph at line $nlines in file $file\n";
-# (ref $errorsub) and &{$errorsub}($errmsg)
-# or (defined $errorsub) and $self->$errorsub($errmsg)
-# or warn($errmsg);
-# }
+ if (length($1) > 1 and $myOpts{'-warnings'} and ! $myData{_CUTTING}) {
+ my $errorsub = $self->errorsub();
+ my $file = $self->input_file();
+ $file = VMS::Filespec::unixify($file) if $^O eq 'VMS';
+ my $errmsg = "*** WARNING: line containing nothing but whitespace".
+ " in paragraph at line $nlines in file $file\n";
+ (ref $errorsub) and &{$errorsub}($errmsg)
+ or (defined $errorsub) and $self->$errorsub($errmsg)
+ or warn($errmsg);
+ }
## Now process the paragraph
parse_paragraph($self, $paragraph, ($nlines - $plines) + 1);
given values. Any unspecified parse-options are unaffected.
## Set them back to the default
- $parser->parseopts(-process_cut_cmd => 0);
+ $parser->parseopts(-warnings => 0);
When passed a single hash-ref, B<parseopts> uses that hash to completely
reset the existing parse-options, all previous parse-option values
## Reset all options to default
$parser->parseopts( { } );
-See L<"PARSING OPTIONS"> for more for the name and meaning of each
+See L<"PARSING OPTIONS"> for more information on the name and meaning of each
parse-option currently recognized.
=cut
*** ERROR: Unknown interior-sequence 'A' at line 30 in file pod/poderrs.t
*** ERROR: Unknown interior-sequence 'Y' at line 31 in file pod/poderrs.t
*** ERROR: Unknown interior-sequence 'V' at line 31 in file pod/poderrs.t
-*** WARNING: unterminated B<...> at line 35 in file pod/poderrs.t
-*** WARNING: unterminated I<...> at line 34 in file pod/poderrs.t
-*** WARNING: unterminated C<...> at line 37 in file pod/poderrs.t
+*** ERROR: unterminated B<...> at line 35 in file pod/poderrs.t
+*** ERROR: unterminated I<...> at line 34 in file pod/poderrs.t
+*** ERROR: unterminated C<...> at line 37 in file pod/poderrs.t
+*** WARNING: line containing nothing but whitespace in paragraph at line 45 in file pod/poderrs.t
*** ERROR: =item without previous =over at line 52 in file pod/poderrs.t
*** ERROR: =back without previous =over at line 56 in file pod/poderrs.t
*** ERROR: =over on line 60 without closing =back (at head2) at line 64 in file pod/poderrs.t
*** ERROR: unresolved internal link 'abc def' at line 96 in file pod/poderrs.t
*** ERROR: unresolved internal link 'passwd(5)' at line 103 in file pod/poderrs.t
*** WARNING: multiple occurence of link target 'oops' at line - in file pod/poderrs.t
-pod/poderrs.t has 22 pod syntax errors.
+pod/poderrs.t has 25 pod syntax errors.