jest has asked for the wisdom of the Perl Monks concerning the following question:
An older part of our codebase has a function for converting a data structure to XML, using XML::Simple (for some legacy reason), and saving it to a directory.
At some point, we upgraded XML::Simple to 2.24, and it started throwing "Use of uninitialized value" errors. Whatever caused this was irrelevant to our purposes, so I put this in a block with "no warnings 'uninitialized';", and all was good.
For no reason that I can tell--I didn't upgrade any package, or my Perl version (5.16.3 for this)--our test suite is now throwing the error again, though the "no warnings" is right there:
Result from test suite:use XML::Simple; my $xml; { # Suppress warnings from XML::Simple 2.24 no warnings 'uninitialized'; my $xmlout = XMLout($data, NoAttr => 1, RootName => undef, Suppres +sEmpty => 0); $xml = '<xml version="1.0" encoding="UTF-8">' . "\n$xmlout</xml>"; }
Where line 205 is the "my $xmlout..." from above.Use of uninitialized value at /[path/to]/Data.pm line 205. Use of uninitialized value at /[path/to]/Data.pm line 205. Use of uninitialized value at /[path/to]/Data.pm line 205. [...]
Can someone explain why I am getting a warning that I explicitly shut off on the immediately preceding line? And how I stop this? The tests pass, but it's distracting as hell to get 50 lines of this error every time we run it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: "no warnings 'uninitialized'" failing
by LanX (Saint) on Oct 16, 2017 at 14:18 UTC | |
Re: "no warnings 'uninitialized'" failing
by haukex (Archbishop) on Oct 16, 2017 at 14:16 UTC | |
Re: "no warnings 'uninitialized'" failing
by Mr. Muskrat (Canon) on Oct 16, 2017 at 18:53 UTC | |
Re: "no warnings 'uninitialized'" failing
by jest (Pilgrim) on Oct 16, 2017 at 20:48 UTC | |
by LanX (Saint) on Oct 16, 2017 at 21:23 UTC | |
Re: "no warnings 'uninitialized'" failing
by Anonymous Monk on Oct 17, 2017 at 03:37 UTC |