http://qs321.pair.com?node_id=484409


in reply to xml/html detection script

The easiest way, is to do a HEAD on the URL in question and see what the returned headers tell you. So, something like:

use LWP::Simple qw/head/; for('http://perlmonks.org/index.pl?displaytype=xml;node_id=484407', 'http://perlmonks.org/index.pl?node_id=484407') { my ($type, $length, $modified_time, $expires, $server) = head($_); print "File is: $type\n"; }
--
b10m

All code is usually tested, but rarely trusted.