Bug#517361: "our" and autosplit don't mix well
Dominique Dumont
dominique.dumont at hp.com
Thu Oct 14 12:32:58 UTC 2010
On Thursday 14 October 2010 13:42:54 Nicholas Bamber wrote:
> I don't suppose you could think of a way to reproduce this outside of
> assassin?
I've looked at $NetAddr::IP::Util. This reminds me of old painful memories
when I played with autosplit (or was it the reverse ? ;-) )
The error message :
Feb 27 11:24:35 mail spamd[16173]: Use of uninitialized value
$NetAddr::IP::Util::n2d_format in sprintf at ../../blib/lib/NetAddr/IP/Util.pm
(autosplit into ../../blib/lib/auto/NetAddr/IP/Util/ipv6_n2d.al) line 356,
<GEN1757> line 153.
shows that autosplit was used: each method is located in its own file.
And in main $NetAddr::IP::Util we have this declaration:
our $n2d_format = "%X:%X:%X:%X:%X:%X:%D.%D.%D.%D";
The problem is that the scope of 'our' declaration is limited to the
compilation block (the file). When autosplit is used, the 'our' declaration
and the ipv6_n2d file are located in 2 separate files. Hence the undef
warning.
The fix is quite simple: both variables declared with 'our' needs to be
changed into global variables. (use vars qw/$n2d_format $n2x_format/;)
But you should talk with upstream for this issue.
Dominique
--
http://config-model.wiki.sourceforge.net/ -o- http://search.cpan.org/~ddumont/
http://www.ohloh.net/accounts/ddumont -o- http://ddumont.wordpress.com/
More information about the pkg-perl-maintainers
mailing list