develooper Front page | perl.perl5.porters | Postings from March 2000

RE: [PATCH 5.6.0-RC1] more warnings tidy ups

Thread Previous | Thread Next
March 15, 2000 07:36
RE: [PATCH 5.6.0-RC1] more warnings tidy ups
Message ID:
From: Hugo []
> In <>,
> writes:
> :From: Hugo []
> That'd be
> :> In
> :> paul. writes:
> :> :
> :> :  * h2xs.PL now includes a "use warning" in the .pm file it creates.
> :> 
> :> Can you explain what the benefit of this is?
> :
> :For the same reason we put a "use strict" at the top of the .pm file that
> :h2xs generates. We are trying to encourage good coding practice. 
> Isn't this somewhat equivalent to the '-w on by default' scenario?

I don't know how much you know about the warnings pragma, so forgive me if
I'm telling you something you already know.

The BIG difference between having a "use warnings" and "-w" is that the
former will be limited to the scope of the new module only, while "-w"
switches warnings on everywhere. That means that anyone developing a new
module (in this case, using the skeleton that h2xs creates) can safely
enable warnings in their module without having to worry about the warnings
setting of modules that they make use of or code that will call their

> I'm not necessarily against it, but I'm not sure how far we want to
> push users to take this up.
> :> Independently of that, is there any reason not to replace the 'use
> :> in with a require() in sub warn {}?
> :
> :None than I can think of. Does it make much of a difference?
> It saves pulling in Carp and Exporter unnecessarily: not relevant for
> h2xs, which tends to drag them in anyway, but may save resources in
> other situations. The cost is an extra 'have I loaded this yet' check
> in the second and subsequent calls to warnings::warn, which I assume
> would rarely be significant.

I'll try to have a look at it this evening


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About