|Just another Perl shrine|
using content-type for judgementby sarvan (Sexton)
|on Jun 22, 2011 at 09:39 UTC||Need Help??|
sarvan has asked for the
wisdom of the Perl Monks concerning the following question:
My perl program gets input as returns a url(its a pdf searcher program). Once i get the url, i used LWP::useragent(head,content_type) to know the type of the content the url holds.
So far, i have got types like application/pdf,application/x-pdf,application/octent-stream,text/html,text/plain.
My question is i want to turn my program to print three kinds of print statements according to this return type of content-type
for e.g: if content-type of the url is "application/pdf" then print "file exist". or if content-type of the url is "text/html" then print "file exist but requires subscription" or simple "no matching found" if there is no url returned..
The problem now is, it only works for this two types of content. but when there are other kinds of contents returned it will not work..