Request for additions to next LWPng release
Blair Zajac (blair@gps.caltech.edu)
Mon, 11 May 1998 12:34:02 -0700 (PDT)
Gisle,
Thank you for your work on LWPng. It's made my life much easier.
Given my work on copying data located by URL's I am putting in a request
for the LWP::Conn::FILE to handle the put() and dir() calls.
I could take this on myself, but since I'm not as familiar with LWPng,
it would be much, much faster for you to take it on. Hopefully, the
interface could be set up in such a way that PUTing a file using another
source, such as a GET, would behave properly.
Also, you put in a previous message the following code:
package LWP::UA;
sub start_request {
my($self, $req) = @_;
print $req->as_string;
bless $req, "LWP::Request" if ref($req) eq "HTTP::Request";
my $res;
$req->{data_cb} = sub { $res = $_[1]; $res->add_content($_[0]) };
$req->{done_cb} = sub { $res = shift; $res->{done}++; };
$self->spool($req);
mainloop->one_event until mainloop->empty || $res;
bless $res, "LWP::Response";
}
package LWP::Response;
use base 'HTTP::Response';
use LWP::MainLoop qw(mainloop);
sub read_content {
my $self = shift;
my $c = $self->content("");
return $c if length($c);
return if $self->{done};
# must wait for more data...
my $data;
$self->request->{data_cb} = sub { $data = $_[0] };
mainloop->one_event until mainloop->empty || defined($data) || $self->{done};
$data;
}
I'd like to see this included in LWPng. If you think it's going to
get enough use, could you install it?
Thanks,
Blair Zajac