Re: Pod::Simple can treat binary as pod due to liberal/inconsistent regexp patterns

[email protected] ("David E. Wheeler") Mon, 12 Jan 2015 11:42:57 -0800
Newsgroups perl.pod-people
Message-ID <[email protected]>
On Jan 8, 2015, at 10:38 PM, Marek Rouchal <[email protected]> wrote:

> I see a potential way of resolving this, but it looks like quite a big effort: the Perl parser could store all text it skips as POD in a similar structure like __DATA__ so that POD parsing utilities could use a pseudo-filehandle like this (reading POD for the current script):
> 
> while (<main::__POD__>) {
> ...
> }
> 
> and for other files there could be a special open() discipline to return only POD using the same parser. What do you think?

I don’t really follow.

Honest, since the current regex matches stuff that is not in fact Pod, I think it is reasonable to tighten up the regex to

    /\A=([a-zA-Z]+[0=9]*)\b/

This won’t completely eliminate the problem, since it will still match stuff that looks like Pod in a file that is not otherwise Pod. But this reduces the chances of that, and should fix the pathological example the MetaCPAN ran into.

Agreed?

If there is consensus on this, I will make the change and post a notice to p5p. I leave it up to the porters to decide whether they also want to update the Perl interpreter to tighten up what it considers Pod.

Best,

David
smime.p7s (application/pkcs7-signature, 4 KB) - not displayed