What's wrong with this eval
statement in Perl? I'm trying to check that the XML is valid by catching any exceptions thrown from the parsing of the file with XML::LibXML:
use XML::LibXML;
my $parser = XML::LibXML->new(); #creates a new libXML object.
eval {
my $tree = $parser->parse_file($file) # parses the file contents into the new libXML object.
};
warn() if $@;