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"; }
|
---|
In Section
Seekers of Perl Wisdom