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

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

From:
Hugo
Date:
March 15, 2000 05:06
Subject:
Re: [PATCH 5.6.0-RC1] more warnings tidy ups
Message ID:
200003151312.NAA25233@crypt.compulink.co.uk
In <5104D4DBC598D211B5FE0000F8FE7EB2067FE5A3@mbtlipnt02.btlabs.bt.co.uk>,
paul.marquess@bt.com writes:
:From: Hugo [mailto:hv@crypt.compulink.co.uk]

That'd be mailto:hv@crypt0.demon.co.uk.

:> In <5104D4DBC598D211B5FE0000F8FE7EB2067FE59F@mbtlipnt02.btlabs.bt.co.uk>,
:> paul. marquess@bt.com 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'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 Carp'
:> in warnings.pm 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.

Hugo



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About