From: Hugo [mailto:hv@crypt.compulink.co.uk] > In <5104D4DBC598D211B5FE0000F8FE7EB2067FE5A6@mbtlipnt02.btlabs.bt.co.uk>, > paul.marquess@bt.com writes: > :> 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. > > This much I understand. However, if we were to have 'use warnings' by > default everywhere it would be essentially the same as having -w on by > default. Assuming ALL modules had it, then yes, it would be essentially the same as having -w enabled. But in reality it isn't going to be like that. The warnings pragma is brand new, so there aren't that may modules that include it. It's likely that there will always be modules that don't include the warnings pragma. > Let me ask a different way: why are the .pm files generated by > h2xs special enough to have 'use warnings' by default, when nothing > else has that? Answering the last part first, nothing else has it because it is very new. It is special enough in that we, the p5p community, are recommending it as a model template for creating a new module. The POD documentation continually hammers home the point that you should run with "-w". The warnings pragma is a more flexible variation on "-w" that can be safely localised to an individual module, so this is simply practicing what we preach. If there are other .pm files that are generated, which I've forgotten about, then they should have "use warnings" embedded in them as well. I would like to think that, where it is appropriate, all core modules that don't have a parallel existence on CPAN should be both "use strict" & "use warnings" clean. There are a lot that aren't even "strict" clean right now. > To repeat, I'm not suggesting this is necessarily a bad idea; I just > don't understand the rationale. No problem. PaulThread Previous | Thread Next