Skip to content

Commit 27eb482

Browse files
committed
ParseXS: process line continuations after POD
Within fetch_para(), the at-end-of-POD code and the main loop both had separate (but similar) chunks of code to read in the next line, with the latter one being more complete. In particular, the latter had logic to process '\' continuation lines, while the POD one didn't. This meant that this gave a parse error: =pod =cut void foo(int i, \ int j) The fix is to make them both use the same code to read the next line.
1 parent 35b69a9 commit 27eb482

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,8 @@ sub fetch_para {
616616

617617
for (;;) {
618618

619+
my $final;
620+
619621
# Skip an embedded POD section
620622

621623
if ($self->{lastline} =~ /^=/) {
@@ -624,11 +626,7 @@ sub fetch_para {
624626
}
625627
$self->death("Error: Unterminated pod")
626628
unless defined $self->{lastline};
627-
$self->{lastline} = readline($self->{in_fh});
628-
return 0 unless defined $self->{lastline};
629-
chomp $self->{lastline};
630-
$self->{lastline} =~ s/^\s+$//;
631-
next;
629+
goto read_next_line;
632630
}
633631

634632
# if present, extract out a TYPEMAP block as a paragraph
@@ -687,7 +685,6 @@ sub fetch_para {
687685

688686
# A general line: process it
689687

690-
my $final;
691688

692689
# Blank line followed by char in column 1. Start of next XSUB?
693690
last if $self->{lastline} =~ /^\S/

dist/ExtUtils-ParseXS/t/001-basic.t

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5821,6 +5821,17 @@ EOF
58215821

58225822
[ 0, 0, qr{XS}, "no undef warning" ],
58235823
],
5824+
[
5825+
"line continuation directly after POD",
5826+
[ Q(<<'EOF') ],
5827+
|=pod
5828+
|=cut
5829+
|void foo(int i, \
5830+
| int j)
5831+
EOF
5832+
5833+
[ 0, 0, qr{XS}, "no errs" ],
5834+
],
58245835
);
58255836

58265837
test_many($preamble, undef, \@test_fns);

0 commit comments

Comments
 (0)