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:
paul.marquess
Date:
March 16, 2000 13:35
Subject:
RE: [PATCH 5.6.0-RC1] more warnings tidy ups
Message ID:
5104D4DBC598D211B5FE0000F8FE7EB2067FE5BB@mbtlipnt02.btlabs.bt.co.uk
 From: Hugo [mailto:hv@crypt.compulink.co.uk]
 
...
> 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


It's nothing to do with warnings.  Put a "use strict 'subs'" in B.pm

  Bareword "C::c" not allowed while "strict subs" in use at B.pm line 6. 

Changing C::c to C::c() or rearranging the order the modules get
included in test makes it do what you expect.

  sub all {  A::a; B::b; C::c() }

Paul

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