PPI
PPI copied to clipboard
Pod below __END__ not parsed if __DATA__ section is present
Pod below __END__
is not recognized if a __DATA__
section is present.
See #15 for additional info.
use strict;
use warnings;
use feature 'say';
use PPI::Document;
=head1 Test
This is a piece of POD.
=head2 Sub
This is also a piece of POD.
=cut
my $content = '';
{
local $/;
open my $fh, '<', $0;
$content = <$fh>;
close $0;
}
my $doc = PPI::Document->new(\$content);
my $pod .= PPI::Token::Pod->merge(@{$doc->find('PPI::Token::Pod')});
say $pod;
__DATA__
# some data here
__END__
=head1 More
This should also be a piece of POD. Should it?
=cut
This test script yields:
=pod
=head1 Test
This is a piece of POD.
=head2 Sub
This is also a piece of POD.
=cut
Expected output:
=pod
=head1 Test
This is a piece of POD.
=head2 Sub
This is also a piece of POD.
=head1 More
This should also be a piece of POD. Should it?
=cut
Thanks a bunch, this is complete enough to make a test and implementation from it. :)
Confirmed - I noticed this when moving things around in Acme::CPANAuthors::Nonhuman and PodWeaver stopped being able to find any pod.