[ macperl-Bugs-523717 ] sysread returning undef instead of 0

[email protected] Wed, 27 Feb 2002 20:16:42 -0800
Newsgroups perl.macperl.porters
Message-ID <[email protected]>
Bugs item #523717, was opened at 2002-02-27 23:16
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=107940&aid=523717&group_id=7940

Category: MacPerl Application
Group: Development Branch
Status: Open
Resolution: None
Priority: 9
Submitted By: Chris Nandor (pudge)
Assigned to: Matthias Neeracher (neeri)
Summary: sysread returning undef instead of 0

Initial Comment:
The following code is having problems:

  #!perl -wl
  use LWP::Simple;
  print LWP::Simple::get('http://pudge.net/Foo.pm');

It should print 'print "hi";\012'.  However, it usually 
returns a warning, '# Use of uninitialized value in 
print.'  I traced this to 
LWP::Simple::_trivial_http_get(), where sysread() will 
get all the data and stick it in $buf, but $n, which 
should be 0 when there's no more data, ends up being 
undef.

If this cannot be fixed immediately, I can fix 
LWP::Simple to use the "full LWP" method instead of the 
trivial method, which does seem to work reliably.  But 
that would just be masking the apparent sysread() 
problem.

When going through the debugger in PP_sysread, length() 
was always 0, and was being returned properly.  Figures.  
I blame quantum singularities.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=107940&aid=523717&group_id=7940