Brethern

How can I tell if a string is a pragma? I'm scanning perl code for dependencies, and want to ignore use xxx when xxx is a pragma. I was advised in the Chatterbox:

pragma's are traditionally all lowercase but I think you are likely to only find good rules of thumb not exact assurances
Problem is that, although modules are traditionally capitalized, a bunch of them in the codebase I'm looking at are not.

I'm extending Module::Dependency. For my present purpose (building a set of graphs of a large codebase) it may be enough to make a list of the most popular pragmas (pragmae?) and just exclude those. However, I'd like to actually post my updates back to CPAN.1 If I do that, I'd like a comprehensive solution.

throop


1Whether I actually get to do that is a question in process. I work for a large company. My coding labor is billed to a client. I asked my manager and a company lawyer shaman whether it was proper for me to post improvements back to CPAN. They're still busy reading bird entrails and casting bones, trying to decide.

In reply to Is it a pragma or a module? by throop

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.