Subject: | Crash when using concurrently with XML::Simple |
The following script will crash:
use XML::Simple;
use Net::Telnet;
#use FileHandle;
open (XMLFILE, '>test.xml');
print XMLFILE '<xml><name>bug</name></xml>';
close(XMLFILE);
my $xml = XML::Simple->new->XMLin('test.xml');
warn $xml->{name};
unlink 'test.xml';
The error message says:
Can't locate object method "read" via package "FileHandle"
at /opt/airwave/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/XML/Parser/Expat.pm
line 477.
An easy workaround is to uncomment the "use FileHandle" line.
Net::Telnet apparently works when using FileHandle rather than
IO::Socket::INET internally (when __io_socket_include evaluates to
false).