I am using XML::Twig for my XML parsing needs.
I would like to know whether there is a way to catch any error's that is generated in this process. Say Something like 'file doesn't exist' or 'no such attribute' or 'no such XML tag' or if there is any issues with the XML file.....
I want to stop the execution of this function if something happens.
Code
my $Tree = new XML::Twig (
TwigHandlers => {
book =>
sub{
$_ -> set_att( name => $newname);
}
}
);
$Tree -> parsefile( "$BooksFile");