Thanks again.   I actually looked it up in the sources now (guess I should've done so earlier), and I presume it's this part in Perl_gv_check(), gv.c:1251:

/* performance hack: if filename is absolute and it's a standa +rd * module, don't bother warning */ #ifdef MACOS_TRADITIONAL # define LIB_COMPONENT ":lib:" #else # define LIB_COMPONENT "/lib/" #endif if (file && PERL_FILE_IS_ABSOLUTE(file) && (instr(file, LIB_COMPONENT) || instr(file, ".pm"))) { continue; } CopLINE_set(PL_curcop, GvLINE(gv)); #ifdef USE_ITHREADS CopFILE(PL_curcop) = (char *)file; /* set for warning */ #else CopFILEGV(PL_curcop) = gv_fetchfile(file); #endif Perl_warner(aTHX_ packWARN(WARN_ONCE), "Name \"%s::%s\" used only once: possible typo", HvNAME_get(stash), GvNAME(gv)); ... with PERL_FILE_IS_ABSOLUTE being defined as (for my platform): #define PERL_FILE_IS_ABSOLUTE(f) (*(f) == '/')

So, I removed the .pm extension (the other two criteria, i.e. /lib/ and absolute path, don't apply in my case -- I even checked with strace(1) what it's really loading). (Update: actually, taking a closer look, I see it's PERL_FILE_IS_ABSOLUTE(file) && ..., so the other two shouldn't apply anyway...)

Interestingly, still none of the following do issue the warning:

require "WarnMe"; --- do "WarnMe"; --- my $code = join '', <DATA>; eval $code; __DATA__ my $val = $Some::Nonexistent::Pkg::variable; --- eval 'my $val = $Some::Nonexistent::Pkg::variable';

Well, I guess some other hack is playing tricks on me...   Anyway. :)


In reply to Re^3: "possible typo" warnings in modules by almut
in thread "possible typo" warnings in modules by almut

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.