The message I get when testing is

Foo.pm did not return a true value at -e line 1. BEGIN failed--compilation aborted at -e line 1.
What this tells me is that the pod block was opened by the =cut directive, and is behaving as I would expect from my reading of perlpodspec.

From perlpodspec,

Pod content is contained in Pod blocks. A Pod block starts with a line that matches m/\A=[a-zA-Z]/, and continues up to the next line that matches m/\A=cut/ or up to the end of the file if there is no m/\A=cut/ line.
Since you are not currently within a pod block when the stray =cut is encountered, it treats it as starting a pod block.

The question then is if the specification should be changed, or left in its simpler form (a match of m/\A=[a-zA-Z]/ starts a pod block, and the next =cut or end of file ends it).

On the one hand, the current state requires that no stray =cut directives exist (at least if you expect the module to work as intended), and keeps the parser fairly simple. On the other hand, it sort of flies in the face of DWIMery. I would probably fall on the side of keeping the parser simple, and updating podchecker to check for this case (=cut starting a POD block), especially since it could actually indicate a missing start tag (code smell).

Update: Firm up my position.

--MidLifeXis


In reply to Re: Excess =cut breaks module by MidLifeXis
in thread Excess =cut breaks module by denishowe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.