go ahead... be a heretic | |
PerlMonks |
Identifying PDF from URLsby listanand (Sexton) |
on May 24, 2010 at 21:26 UTC ( [id://841446]=perlquestion: print w/replies, xml ) | Need Help?? |
listanand has asked for the wisdom of the Perl Monks concerning the following question:
Hi perl monks, I have a situation where I need to identify whether a URL is a PDF file or not. Here's an example URL : http://ccdl.libraries.claremont.edu/u?/stc,87 Looking at it, it's not obvious that it links to a PDF. Here's the relevant code snippet. It is not working though. Thanks in advance. use MIME::Types; my $mt = MIME::Types->new; my $url="http://ccdl.libraries.claremont.edu/u?/stc,87"; if($mt->mimeTypeOf($url) eq "application/pdf"){ print "$url is a PDF file\n"; }
Back to
Seekers of Perl Wisdom
|
|