You mean just get part of the file located with the URL?

There is almost certainly a way to do it, since wget (et al) can be instructed to continue.

Personally, I can't find a single relevant option in LWP, LWP::UserAgent, HTTP::Request, HTTP::Headers, and more.

I'm very curious to see how how you would get a selected portion of a file with LWP. Someone will know.

UPDATE #1: Further investigation has revealed that you can set a "range" header with
$request_object->header( $field => $value ); but I haven't yet worked out the particulars of the header.

use strict; use LWP::UserAgent; use HTTP::Request; my $ua = LWP::UserAgent->new(); my $req1 = HTTP::Request->new(GET => $your_URL); $req1->header( Range => 'bytes=0-499' ); # bytes 0 through 499 my $req2 = HTTP::Request->new(GET => $your_URL); $req2->header( Range => 'bytes=500-' ); # bytes 500 onward my $res1 = $ua->request( $req1 => "file1.html" ); my $res2 = $ua->request( $req2 => "file2.html" ); # A byte range operation MAY specify a single range of bytes, or a set + of ranges within a # # ranges-specifier = byte-ranges-specifier # byte-ranges-specifier = bytes-unit "=" byte-range-set # byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec + ) # byte-range-spec = first-byte-pos "-" [last-byte-pos] # first-byte-pos = 1*DIGIT # last-byte-pos = 1*DIGIT

-Paul


In reply to Re: How to read just part of a url's content by jettero
in thread How to read just part of a url's content by no_germs

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.