in reply to Re: How do I retrieve a piece of a file? (use a callback)
in thread How do I retrieve a piece of a file?

Silly grinder, length is for kids :D (request takes an additional arg, which is, bytesize)
use HTTP::Request; use LWP::UserAgent; my $html = ''; my $request = HTTP::Request->new(GET => "$url/$file" ); my $ua = LWP::UserAgent->new; my $response = $ua->request($request, \&cb, 4096); sub cb { print $_[0]; die; }

 
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void

perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

  • Comment on (crazyinsomniac) Re^2: How do I retrieve a piece of a file? (use a callback)
  • Download Code

Replies are listed 'Best First'.
Re: (crazyinsomniac) Re^2: How do I retrieve a piece of a file? (use a callback)
by grinder (Bishop) on Nov 25, 2001 at 01:20 UTC
    Yeah, but the person said that trying it that way didn't work as expected. I was giving her/him another way of doing it.

    Correct me if I'm wrong, but in your example if the remote site is (for instance) heavily loaded and sends you a chunk of (for example) 160 bytes, your callback will be called, die, and close the connection prematurely.

    later: I suppose what I am talking about is this in another form.

    --
    g r i n d e r