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 16, 2000 07:53
RE: [PATCH 5.6.0-RC1] more warnings tidy ups
Message ID:
From: Hugo []
> In <>,
> 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
> :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
> :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. 


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