Subject: | Use of uninitialized value in concatenation (.) or string at XML/Dumper.pm line 400. |
Date: | Tue, 23 Feb 2016 07:46:23 +0000 |
To: | "bug-XML-Dumper [...] rt.cpan.org" <bug-XML-Dumper [...] rt.cpan.org> |
From: | "Weickum, Michael" <michael.weickum [...] tds.fujitsu.com> |
You can avoid this warning message which will appear if you pass a undef scalar to pl2xml.
my $test=undef;
my $dump = new XML::Dumper;
my $xml=$dump->pl2xml( $test );
print $xml;
Will give you a warning message: Use of uninitialized value in concatenation (.) or string at XML/Dumper.pm line 400.
Just add a little check in line 400:
400: - $string .= "\n" . " " x $indent . $type . xml_escape( $ref ) . "</scalar>";
400: + $string .= "\n" . " " x $indent . $type . ( defined $ref ? xml_escape( $ref ) : '' ) . "</scalar>";
[Webinar "Managed on-premise Cloud"]<https://ts.fujitsu.com/cisi/de/Event.aspx?ID=5a24805d-7ed4-48c6-a99e-cd97d3e102be#TabNav?utm_source=FTDS%20EMail&utm_medium=Signature%20FTDS%20EMail&utm_campaign=Managed%20on-premise%20Cloud&utm_term=&utm_content=Anmeldung>