Now that I've switched from Win32::Internet to LWP::UserAgent, the only thing I haven't been able to figure out is how do I bail out of a request when I'm using a sub to process each chunk? In other words, if the user wants to cancel the download, what should the "chunk processing" sub do?
my $res = $ua->request(HTTP::Request->new(GET => "http://" . $server . $page),
sub
{
my($chunk, $res) = @_;
print $chunk;
# HOW DO I BAIL HERE? (PREVENT FURTHER DOWNLOADING)
});
Thanks to everyone who helped me with Win32::Internet and who steered me toward LWP!
-----Original Message-----
From: Sisyphus [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 12:33 PM
To: [EMAIL PROTECTED]
----- Original Message -----
From: "Jeff Shanholtz" <[EMAIL PROTECTED]>
> Thomas_M suggested using
> LWP, but I just looked at the module (since at this point I'm willing to
> do a complete rewrite to get past these problems) and I don't see how
> you can request files a chunk at a time (which I require in order to
> display continual status for big files).
I think LWP::UserAgent will accommodate your needs.
From its documentation:
request() " can also take an optional chunk size as the third argument.
This variant can be used to construct "pipe-lined" processing, where
processing of received chunks can begin
before the complete data has arrived."
Cheers,
Rob
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs