Subject: | parse of no final newline vs perl -w |
Date: | Tue, 15 Mar 2011 11:38:36 +1100 |
To: | bug-Pod-Parser [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With Pod::Parser 1.37 and recent debian perl 5.10.1 running foo.pl below
as
perl -w foo.pl
gives warnings
Use of uninitialized value in concatenation (.) or string at /usr/share/perl/5.10/Pod/InputObjects.pm line 327, <GEN0> line 1.
Use of uninitialized value in concatenation (.) or string at /usr/share/perl/5.10/Pod/InputObjects.pm line 327, <GEN0> line 1.
Use of uninitialized value $text in pattern match (m//) at /usr/share/perl/5.10/Pod/Parser.pm line 1019, <GEN0> line 1.
It seems that if the input ends with a command and no final "\n" newline
then there's some undefs. It'd be good if input like that was clean to
"perl -w".
The first two warnings might be only from not having actual subclass
code for text output, but I struck the last one,
$myData{_WHITESPACE} = $text =~ /^[^\S\r\n]+\Z/m ? 1 : 0;
in a sensible subclass. It seems to throw a warning outside anything
the subclass could easily control.
use strict;
use Pod::Parser;
use IO::String;
print Pod::Parser->VERSION,"\n";
my $fh = IO::String->new("=head1");
my $p = Pod::Parser->new;
$p->parse_from_filehandle ($fh);