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

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

Thread Previous | Thread Next
From:
Hugo
Date:
March 16, 2000 08:44
Subject:
Re: [PATCH 5.6.0-RC1] more warnings tidy ups
Message ID:
200003161643.QAA29575@crypt.compulink.co.uk
In <5104D4DBC598D211B5FE0000F8FE7EB2067FE5B3@mbtlipnt02.btlabs.bt.co.uk>,
paul.marquess@bt.com 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/A.pm line 3.
Use of uninitialized value in addition (+) at lib/B.pm line 4.
crypt% 

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

Hugo
--- test
#!/usr/bin/perl
use A;
use B;
use C;

B::all

--- A.pm
package A;

sub a { $undef + 0 }

1;
--- B.pm
package B;
use warnings;

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

1;
--- C.pm
package C;

sub c { $undef + 0 }

1;
--- end

Thread Previous | Thread Next


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