Subject: | Retain newlines for POD in case of PPR::decomment |
Date: | Thu, 23 Apr 2020 14:15:55 +0200 |
To: | bug-PPR [...] rt.cpan.org |
From: | Albert <albert.tests [...] gmail.com> |
Based on my stack overflow issue (and the answer by Håkon Hægland ):
https://stackoverflow.com/questions/61307663/retain-newlines-for-pod-in-case-of-ppruncomment
I think it might be useful for the PPR package to have this facility as an
enhancement / optional setting in PPR as well.
For completeness the text from the stackoverflow issue:
When using code like:
```
my $aFileData = read_file($sFilename);
$aFileData =~ s/\r$//g;
my @aRawFileData= split /(?<=\n)/, $aFileData;
$self->{'_aRawFileData'} = \@aRawFileData;
my $aUncommentFileData_tmp = PPR::decomment(join($", $aFileData));
my @aUncommentFileData = split /(?<=\n)/, $aUncommentFileData_tmp;
$self->{'_aUncommentFileData'} = \@aUncommentFileData;
print("@{$self->{'_aRawFileData'}}===============\n@
{$self->{'_aUncommentFileData'}}========================\n");
```
and having input like in the file of `$sFilename`:
```
my $z=1;
=head1 HEADER
Just some documentation
=cut
my $x=7;
# Just some documentation
my $y=11;
sub is_top_level {
}
```
We see in the output that the comment lines are gone and that the POD is
gone. So far so good:
```
my $z=1;
my $x=7;
my $y=11;
sub is_top_level {
}
```
one thing we see is that the POD has been replaced by just **1 line**,
whilst for the comment line is replaced by an empty line.
Is it possible that the POD is also replaced by empty lines (so in this
case **5 lines**)?
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>