Ask a question :)
#!/usr/bin/perl -- use strict; use warnings; use WWW::Mechanize 1.60; my $ua = WWW::Mechanize->new(autocheck => 1); my $url = 'http://documents-dds-ny.un.org/doc/UNDOC/GEN/N08/588/39/pdf +/N0858839.pdf?OpenElement'; my $file = 'test.pdf'; $ua->get($url,":content_file" => $file); $ua->dump_headers; if( $ua->is_html() ){ print qq!\nBUMMER, NOT PDF (is_html), DELETING "$file"\n\n!; unlink $file or die "DELETING FAILED $!"; } __END__ Cache-Control: no-cache Date: Sat, 30 Jan 2010 18:27:37 GMT Server: Lotus-Domino Content-Encoding: gzip Content-Length: 1483 Content-Type: text/html; charset=UTF-8 Expires: Tue, 01 Jan 1980 06:00:00 GMT Client-Date: Sat, 30 Jan 2010 18:27:30 GMT Client-Peer: 157.150.195.130:80 Client-Response-Num: 1 NtCoent-Length: 3406 BUMMER, NOT PDF (is_html), DELETING "test.pdf"

In reply to Re: Perl Mechanize - Header Help required. by Anonymous Monk
in thread Perl Mechanize - Header Help required. by smilingsagar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.