From your /msg, I've been able to put together the following:

[johnsca@CORY tmp]$ cat tst.pm #!/usr/bin/perl package tst; use warnings; use strict; *import = \&foo; sub foo { print "Import foo\n"; } 1; [johnsca@CORY tmp]$ cat tst.pl #!/usr/bin/perl use warnings; use strict; use lib '.'; use tst; [johnsca@CORY tmp]$ perl -c tst.pm Name "tst::import" used only once: possible typo at tst.pm line 9. tst.pm syntax OK [johnsca@CORY tmp]$ perl -c tst.pl Import foo tst syntax OK [johnsca@CORY tmp]$ perl tst.pm Name "tst::import" used only once: possible typo at tst.pm line 9. [johnsca@CORY tmp]$ perl tst.pl Import foo

From this, I think makes sense. The warning when running perl -c tst.pm (and perl tst.pm) is appropriate, as import is only used once, when you consider only tst.pm. However, once you throw tst.pl into the mix, you get another (implicit) use of *tst::import via the use, as you said, which silences the warning. This makes sense as, according to the docs for use:

It is exactly equivalent to

    BEGIN { require Module; import Module LIST; }

except that Module must be a bareword.

To prevent the warning when checking tst.pm, you can locally disable warnings, as I suggested before, or you can add another (no-op) reference to *import. In the code below, I use use vars qw/*import/; because our doesn't seem to like typeglobs. :) <Update>Though our $import; seems to get rid of the error just fine.</Update>

[johnsca@CORY tmp]$ cat tst.pm #!/usr/bin/perl package tst; use warnings; use strict; use vars qw/*import/; # or: *import = *import; *import = \&foo; sub foo { print "Import foo\n"; } 1; [johnsca@CORY tmp]$ perl -c tst.pm tst.pm syntax OK

bbfu
Black flowers blossum
Fearless on my breath


In reply to (bbfu) (cause?) Re2: (bbfu) (warning only during -c) Re3: 'used once' during perl -c by bbfu
in thread 'used once' during perl -c by John M. Dlugosz

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.