lwp-0.04: a patch, buglet and a question

Achim Bohnet (ach@rosat.mpe-garching.mpg.de)
Thu, 07 Sep 1995 15:54:57 +0200


This is a multipart MIME message.

--===_0_Thu_Sep__7_15:35:39_MET_DST_1995
Content-Type: text/plain; charset=us-ascii

Hello,
I try to write a 'progess indicator' tk composite widget for www downloads.
I use the callback version of $ua->request. So far so good but
I would like display (ala Mosaic, Netscape):
 	- looking up, connecting, wait response ..
	- Content-length to indicate percentage transmitted
	  ...
Any suggestions how to do it? I hope there more callbacks I could
use :-)

IMHO it would also be a nice feature for mirror/request
to have a -verbose switch which informs one about the progress on STDERR.

There are some minor ommisions in mirror and request (see patch below).
Further it's not documented what return code is expected from a callback
function in $ua->request($request,\&callback). My try and error solution
is 0/1 on failure/success. Please add a line to the pod with whatever is
correct.

Further I got a perl warning as soon as the host part of the url is wrong:

~/data1/perl/tkgeturl > cat > bug.a.004
use strict;
use LWP::UserAgent;

my $url = 'http://not.existing.domain/foo.bar'; # <== does not exist

my $ua = new LWP::UserAgent;
my $request = new HTTP::Request('GET',$url);
my $response = $ua->request($request, sub { 1; }, 1024);
^D 
~/data1/perl/tkgeturl > perl -w ./bug.a.004
Use of uninitialized value at /usr/local/lib/perl5/LWP/Socket.pm line 111.
~/data1/perl/tkgeturl >


Achim
P.S.: Thanks very much for this nice library

--===_0_Thu_Sep__7_15:35:39_MET_DST_1995
Content-Type: application/x-patch
Content-Description: lwp.patch

--- bin/mirror.PL.orig	Wed Sep  6 01:51:37 1995
+++ bin/mirror.PL	Thu Sep  7 14:13:24 1995
@@ -27,15 +27,15 @@
 The timeout value specified with the C<-t> option.  The timeout value
 is the time that the program will wait for response from the remote
 server before it fails.  The default unit for the timeout value is
-seconds.  You might append "m" to the timeout value to make it
-minutes.
+seconds.  You might append "m" or "h" to the timeout value to make it
+minutes or hours, repectively.
 
 Because this program is implemented using the LWP library, it only
 supports the protocols that LWP supports.
 
 =head1 SEE ALSO
 
-L<get>, L<LWP>
+L<GET>, L<LWP>
 
 =head1 AUTHOR
 
@@ -55,7 +55,7 @@
 $opt_v = undef;  # print version
 $opt_t = undef;  # timeout
 
-unless (getopts("hvb:t:")) {
+unless (getopts("hvt:")) {
     usage();
 }
 
--- bin/request.PL.orig	Wed Sep  6 01:51:39 1995
+++ bin/request.PL	Thu Sep  7 13:17:28 1995
@@ -11,7 +11,7 @@
 
 =head1 NAME
 
-request - Simple WWW user agent
+request, GET, HEAD, POST - Simple WWW user agent
 
 =head1 SYNOPSIS
 
@@ -54,8 +54,8 @@
 Set the timeout value for the requests.  The timeout is the amount of
 time that the program will wait for a response from the remote server
 before it fails.  The default unit for the timeout value is seconds.
-You might append "m" to the timeout value to make it minutes.  The
-default timeout is '3m', i.e. 3 minutes.
+You might append "m" or "h" to the timeout value to make it minutes or
+hours, respectively.  The default timeout is '3m', i.e. 3 minutes.
 
 =item -i <time>
 

--===_0_Thu_Sep__7_15:35:39_MET_DST_1995--