Bug#521609: Warning: Name "Archive::Tar::WARN" used only once: possible typo

Vincent Lefevre vincent at vinc17.org
Sun Mar 29 20:42:31 UTC 2009


On 2009-03-29 22:04:10 +0300, Niko Tyni wrote:
> On Sat, Mar 28, 2009 at 11:30:32PM +0100, Vincent Lefevre wrote:
> > #!/usr/bin/env perl
> > use warnings;
> > require Archive::Tar;
> > $Archive::Tar::WARN = 0;
> > 
> > gives the following warning when run:
> > 
> > vin:~> ./tst
> > Name "Archive::Tar::WARN" used only once: possible typo at ./tst line 4.
> 
> This is expected behaviour: it's a compile-time warning and you're
> explicitly loading Archive::Tar at run time.

OK, I now understand. Then I think that the problem is in perl.
I suppose that lines such as

  require SomeModule;

are seen at compile-time. IMHO, in such a case, perl should disable
all

  Name "%s::%s" used only once: possible typo

warnings for the namespace SomeModule, as they can obviously be
spurious warnings.

>  use vars qw($Archive::Tar::WARN);

This doesn't seem to be documented and may be annoying if there
are lots of variables. Also, if the module gets renamed and the
user modifies only the "require" line, this will defeat the purpose
of the warning.

>  no warnings 'once';

One doesn't necessarily want to disable all these warnings.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)






More information about the Perl-maintainers mailing list