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 08:44
Re: [PATCH 5.6.0-RC1] more warnings tidy ups
Message ID:
In <>, writes:
:> 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.

(And because we chose not to make it the default.)

: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. 

Ok, I'm happy enough with that.

The only thing then that still slightly worries me (after trying a couple
of things) is this:

crypt% perl -w -Ilib test
Use of uninitialized value in addition (+) at lib/ line 3.
Use of uninitialized value in addition (+) at lib/ line 4.

.. and I don't understand why A::a warns but not C::c.

--- test
use A;
use B;
use C;


package A;

sub a { $undef + 0 }

package B;
use warnings;

sub b { $undef + 0 }
sub all { A::a; B::b; C::c }

package C;

sub c { $undef + 0 }

--- end

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