Subject: | POD string in variables not handled properly |
I have been trying to parse Perl files that contain POD with
Pod::Parser. I have noticed that Pod::Parser fails to properly handle
certain cases. If the Perl file contains a variable whose content is
POD-formatted, then this POD will be extracted by Pod::Simple although
it should not be extracted since it is not a POD section but the content
of a variable.
I attached a test file containing POD to reproduce the problem. Run the
following and notice that a POD that should not be extracted is extracted:
podselect tricky.pl
The POD parsing mechanism of perltidy seems to be more robust and able
to detect this variable-embedded POD. Running the following properly
keeps the POD string in the file:
perltidy --delete-pod tricky.pl
Subject: | tricky.pl |
#! /usr/bin/env perl
use strict;
use warnings;
=head1 NAME
Tricky
=cut
print "Starting...\n--------\n";
my $var =<<EOS;
=head1 FAKE_POD_ENTRY_HERE
This should not be extracted as POD since it is the content of a variable
=cut
EOS
print $var;
print "--------\nDone!\n";
exit;
__END__
=head1 SYNOPSIS
Tricky file to test proper POD parsing