http://qs1969.pair.com?node_id=601014

lakeTrout has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I built an XML parser from a flat file. From here, I woul like the XML file to print out in it's entirety to the browser (to verify it's well formed and eaiser to look at than text -- it can be it's own script because it will be part of a process/wizzard). Essentially, I just need a script that prints an XML file that already exists to a browser and nothing else. Am I making this harder than it has to be?

I'm thinking something like this, but I'm not sure if this is the right road to go down or if there isn't something better. Any help much appreciated!

#!/usr/bin/perl use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); print header; print header, start_html ("XML File"), open(XMLFILE, "foo.xml"); while (<XMLFILE>){ print; }