Skip to content

Commit

Permalink
Ignore fake pod starting with "\r" also
Browse files Browse the repository at this point in the history
Pod::Simple "splits" lines at \r, \n, or \r\n.
  • Loading branch information
rwstauner committed Dec 14, 2014
1 parent fc7e25e commit af93eb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/MetaCPAN/Document/File.pm
Expand Up @@ -349,13 +349,16 @@ sub _build_pod {
# want in our pod text.

$content =~ s/
^=[a-zA-Z][a-zA-Z0-9]* # looks like pod
# Pod::Simple::parse_string_document() "supports \r, \n ,\r\n"...
(\A|\r|\r\n|\n) # beginning of line
=[a-zA-Z][a-zA-Z0-9]* # looks like pod
(?! # but followed by something that isn't pod:
[a-zA-Z0-9] # more pod chars (the star won't be greedy enough)
| \s # whitespace ("=head1 NAME\n")
| $ # end of line ("=item\n"
)
//mgx;
//gx;

my $text = "";
$parser->output_string( \$text );
Expand Down
3 changes: 2 additions & 1 deletion t/var/fakecpan/configs/binary-data.pl
Expand Up @@ -32,7 +32,8 @@
not pod
\0
=he\x50\x00\x7b
=he\x50\x00\x7b;\x{0d}=Ddhé\x{01}UÕÌ
EOF
},
{
Expand Down

0 comments on commit af93eb8

Please sign in to comment.