develooper Front page | perl.perl5.porters | Postings from March 2000

[Patch perl-5.5.670/lib/Pod/Parser.pm] slight bug on =over/=back

From:
Robin Barker
Date:
March 6, 2000 10:23
Subject:
[Patch perl-5.5.670/lib/Pod/Parser.pm] slight bug on =over/=back
Message ID:
200003061823.SAA22425@tempest.npl.co.uk
I guess 

% perl -MPod::Parser -we 'Pod::Parser->new->parse_from_filehandle(\*STDIN)'

should be a NOOP.  


But (for perl-5.5.670):

% perl -MPod::Parser -we 'Pod::Parser->new->parse_from_filehandle(\*STDIN)' \
	< pod/perlfunc.pod | diff pod/perlfunc.pod -
94,96c94
< =over
< 
< =item Functions for SCALARs or strings
---
> =over=item Functions for SCALARs or strings
214,216c212
< =back
< 
< =head2 Portability
---
> =back=head2 Portability
3165,3167c3161
< =back
< 
< Examples:
---
> =backExamples:
5725c5719
< =back
---
> =back
\ No newline at end of file



The problem is that =cmd with no text, loses its line terminators.

I have a patch, which puts the lost text in the separator.

Robin

--- lib/Pod/Parser.pm	2000/03/06 17:48:11	1.1
+++ lib/Pod/Parser.pm	2000/03/06 17:51:57	1.2
@@ -947,8 +947,7 @@
         ## and whatever sequence of characters was used to separate them
         $pfx = $1;
         $_ = substr($text, length $pfx);
-        $sep = /(\s+)(?=\S)/ ? $1 : '';
-        ($cmd, $text) = split(" ", $_, 2);
+        ($cmd, $sep, $text) = split /(\s+)/, $_, 2; 
         ## If this is a "cut" directive then we dont need to do anything
         ## except return to "cutting" mode.
         if ($cmd eq 'cut') {

-- 
Robin Barker                        | Eail:  Robin.Barker@npl.co.uk
CISE, Building 10,                  | Phone: +44 (0) 20 8943 7090
National Physical Laboratory,       | Fax:   +44 (0) 20 8977 7091
Teddington, Middlesex, UK. TW11 OLW | WWW:   http://www.npl.co.uk



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About