And it also handles redirections correctly, it also supplies the HTTP/1.1 "Host:" header automatically, it also correctly parses HTTP/1.1 responses ("chunked" encoding types, etc.), and it automatically knows when an error condition occurs (the result will be undefined). It should detect when the resulting data was cut off in mid-stream, it will not hang indefinitely waiting for a response. It doesn't require that you know HTTP or understand what HTTP headers are. It also will do form POSTs with a very minor change.

If that's all stuff that you don't need, then you're right, you're fine going with a bare-bones IO::Socket method.

You shouldn't have to explain to anybody how to get some magic module working. Just copy the stuff over along with your script. That's what I mean when I say it's really trivial to extend a typical distribution method just one step further to include a module. And you are also right, this is a pretty trivial thing to implement without a module, but more often than not, the request is for something a bit more complicated (like parsing HTML). In cases like that, it's usually pretty easy to get something that works for the most extreme basic cases, but anything at all that falls outside of that case (HTML tags spanning lines, for example, or encompassing brackets in the tag) will break their algorithm, they end up having to do a lot more work to fix their broken code, and they end up with some monstrous piece of garbage that could have been simplified to nothing by using pre-written modules.

I realize that this doesn't necessarily apply to you, but I'm trying to explain why those people in this thread that are incessantly recommending the installation of a real module to do the job are doing that.


In reply to Re: Re: Re: Re: (tye)Re: Grabbing a web page without LWP or the like by Fastolfe
in thread Grabbing a web page without LWP or the like by Hot Pastrami

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.