in reply to 'used once' during perl -c

First, how do I silence this warning during -c?
Just turn off that type of warnings for the given scope e.g
{ no warnings 'once'; *import = coderef(); }
Or just mention it again in some way (according to perldiag).
Second, why does it let me refer to *import without declaring it first or qualifying it when use strict is in effect?
Because strict doesn't deal with globs. I think it's assumed if you're messing with globs you probably (and hopefully) know what you're doing.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: 'used once' during perl -c
by John M. Dlugosz (Monsignor) on Nov 01, 2002 at 16:14 UTC
    When I use warnings, why does the 'once' warning only show up during a -c check, not during a regular run? Is the meaning of "use warnings" (with no parameters) different in these two cases?

      I'm afriad I'm unable to duplicate that here. I get the warning both when I -c it, and when I run it which, as far I as I know, is the correct behavior. This is with both ActiveState perl, and Cygwin perl.

      Perhaps you can post the code that's causes that behavior? You're not on 5.8.0, are you? Both of my perl's are 5.6.1. *shrug*

      (Output from my test below)

      bbfu
      Black flowers blossum
      Fearless on my breath

        Hmm... a guess: my code is in a .pm file. Perhaps Perl automatically enters another "use" of import when doing a use of a module. Then the issue isn't -c or not, but main-program or not.