From: Hugo [mailto:hv@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 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 module. > 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. I'll try to have a look at it this evening PaulThread Previous | Thread Next