Perl: scripted yield code for XML check and python interface