- Notifications
You must be signed in to change notification settings - Fork587
Closed
Labels
Description
Description
The perl parser is supposed to skip over embedded POD sections. The end of a POD section is marked by a=cut
command. However, not every line that starts with=cut
is a=cut
command. For example:=cute
,=cut2
,=cut_dry
.
The perl parser does not correctly recognize these and, in the case of=cute
, behaves differently depending on whether we are in string eval or not.
Steps to Reproduce
use strict;use warnings;print"1..9\n";my$test = 1;my$foo;$foo ="";=pod=cute$foo = "not ";=pod=cutprint$foo,"ok$test - =cute does not end POD\n";$test++;$foo ="";=pod=cut2$foo = "not ";=pod=cutprint$foo,"ok$test - =cut2 does not end POD\n";$test++;$foo ="";=pod=cut_$foo = "not ";=pod=cutprint$foo,"ok$test - =cut_ does not end POD\n";$test++;$foo ="not";=pod=cut$cene$foo ="";=pod=cutprint$foo,"ok$test - =cut\$cene ends POD\n";$test++;# Same as above, but in string eval.evalq{$foo = "";=pod=cute$foo = "not ";=pod=cutprint $foo, "ok $test - =cute does not end POD\n";$test++;$foo = "";=pod=cut2$foo = "not ";=pod=cutprint $foo, "ok $test - =cut2 does not end POD\n";$test++;$foo = "";=pod=cut_$foo = "not ";=pod=cutprint $foo, "ok $test - =cut_ does not end POD\n";$test++;$foo = "not ";=pod=cut$cene$foo = "";=pod=cutprint $foo, "ok $test - =cut\$cene ends POD\n";$test++;};print$@eq"" ?"" :"not","ok$test - did not throw an error\n#$@\n";__END__
Output:
1..9ok 1 - =cute does not end PODnot ok 2 - =cut2 does not end PODnot ok 3 - =cut_ does not end PODok 4 - =cut$cene ends PODnot ok 5 - =cute does not end PODnot ok 6 - =cut2 does not end PODnot ok 7 - =cut_ does not end PODok 8 - =cut$cene ends PODok 9 - did not throw an error#
Expected behavior
1..9ok 1 - =cute does not end PODok 2 - =cut2 does not end PODok 3 - =cut_ does not end PODok 4 - =cut$cene ends PODok 5 - =cute does not end PODok 6 - =cut2 does not end PODok 7 - =cut_ does not end PODok 8 - =cut$cene ends PODok 9 - did not throw an error#
Perl configuration
This is with v5.40.0, but it should affect all perl versions (except before 5.8.9 the=cute
test will probably fail without eval, too).