in reply to XML::Parser question.
Your program is trying to parse the string 'test.xml' as its XML input, and failing. Either read the test file into a string and pass that to the parser's parse method, or use parsefile instead:
$parser->parsefile('test.xml');