Patch for LWPng-alpha
Blair Zajac (blair@gps.caltech.edu)
Tue, 5 May 1998 18:26:15 -0700 (PDT)
Hi,
The enclosed patch fixes the following warning:
Use of uninitialized value at /opt/perl5/lib/site_perl/LWP/Conn/FTP.pm line 904.
Use of uninitialized value at /opt/perl5/lib/site_perl/LWP/Conn/FTP.pm line 894.
When the following code is used:
use strict;
use LWP::UA;
use LWP::MainLoop qw(mainloop);
use LWP::Request;
use LWP::Conn::HTTP;
my $ua = LWP::UA->new;
my $res;
my $count = 10;
my $req = LWP::Request->new(PUT => 'ftp://ftp/incoming/bz.txt');
$req->content("123" x 1000);
$req->content(sub { return undef unless $count--; "Count is $count\n"; });
$req->{done_cb} = sub { $res = shift; };
$ua->spool($req);
mainloop->one_event until $res;
Blair Zajac
diff -rc LWPng-1/lib/LWP/Conn/FTP.pm LWPng-alpha-0.20/lib/LWP/Conn/FTP.pm
*** LWPng-1/lib/LWP/Conn/FTP.pm Wed Apr 29 06:39:39 1998
--- LWPng-alpha-0.20/lib/LWP/Conn/FTP.pm Tue May 5 18:18:10 1998
***************
*** 891,897 ****
#print "Writeable\n";
mainloop->activity(*$self->{'lwp_ftp'});
my $buf = \*$self->{'lwp_wbuf'};
! unless (length $$buf) {
my $w = *$self->{'lwp_write'};
unless ($w) {
*$self->{'lwp_ftp'}->data_done();
--- 891,897 ----
#print "Writeable\n";
mainloop->activity(*$self->{'lwp_ftp'});
my $buf = \*$self->{'lwp_wbuf'};
! unless (defined $$buf and length $$buf) {
my $w = *$self->{'lwp_write'};
unless ($w) {
*$self->{'lwp_ftp'}->data_done();
***************
*** 901,907 ****
$w = $$w if ref($$w);
if (ref($w) eq "CODE") {
$$buf = &$w();
! unless (defined $buf and length $$buf) {
delete *$self->{'lwp_write'};
return;
}
--- 901,907 ----
$w = $$w if ref($$w);
if (ref($w) eq "CODE") {
$$buf = &$w();
! unless (defined $$buf and length $$buf) {
delete *$self->{'lwp_write'};
return;
}