in reply to XML Pretty Printer
This looks very good!
You could add the common idiom:
if( $ARGV[0]) { $parser->parsefile( $ARGV[0]); } else { $parser->parse( \*STDIN); } [download]
to run the program either on STDIN or on the first argument