Bug? Newbie question?
Howard, Dan: CIO (howard.dan@ic.gc.ca)
Mon, 27 Jan 1997 13:56:27 -0500
{This paragraph is skippable-- just a bit about why I'm using LWP} I'm just
starting to use libwww-perl to write a sort of mini-hybrid between a
Yahoo-type web resource and a Webcrawler-type one, for the Canadian
goverment. The idea is that people in gov't will be able to point this
robot at pages on the web they feel are relevant to their jurisdiction. The
pages will be retrieved and added to our searchable index, with additional
search fields such as "country", "industry" or "topic" manually filled out
by the person dispatching the robot. See us so far at
http://strategis.ic.gc.ca.
I have two problems. The first I'm pretty sure is a bug of sorts. The
second may be one. Either of them *could* be due to the fact that I am not
excellent with low-level Unix or low-level advanced Perl programming, and I
apologise for the dumb questions if this is the case. Please judge for
yourselves.
The first bug is that LWP seems to >>**change its mind**<< on whether or not
HTTP is a supported protocol during two sequential queries.
Here is my test program:
>#!/usr/local/bin/perl5
> use LWP::UserAgent;
> use LWP::Debug qw(level); level('+');
>
> $ua = new LWP::UserAgent;
>
> print $ua->is_protocol_supported('http') ? "HTTP OK\n" : "HTTP not
OK\n";
> print $ua->is_protocol_supported('http') ? "HTTP OK\n" : "HTTP not
OK\n";
>
> my $req = new HTTP::Request GET => 'http://www.yahoo.com/';
> my $res = $ua->request($req);
Here is it's output:
>LWP::UserAgent::new: ()
>HTTP not OK
>HTTP OK
>LWP::UserAgent::request: ()
>LWP::UserAgent::simple_request: GET http://www.yahoo.com/
>LWP::UserAgent::_need_proxy: (http://www.yahoo.com/)
>LWP::UserAgent::_need_proxy: Not proxied
>Can't locate object method "use_alarm" via package "LWP::Protocol::http"
> at /opt/GNUperl5/lib/site_perl/LWP/UserAgent.pm line 214.
Note the "HTTP OK... HTTP not OK" contradiction.
The second problem is, obviously, the bit about "use_alarm". If this is
just something I'm not understanding correctly, perhaps you could direct me
to the right piece of documentation.
Thanks very much in advance,
Dan Howard
-------------------
Ottawa, Canada