develooper Front page | perl.libwww | Postings from April 2001

LWP::RobotUA problem

Thread Next
From:
Reinier Post
Date:
April 24, 2001 08:05
Subject:
LWP::RobotUA problem
Message ID:
20010424170528.B21753@win.tue.nl
  Hello Gisle and all,

I use the following local patch to LWP::RobotUA :

% perldoc -m LWP::RobotUA.pm | diff - lib/LWP/RobotUA.pm
1c1
< # $Id: RobotUA.pm,v 1.17 2000/04/09 11:21:11 gisle Exp $
---
> # $Id: RobotUA.pm,v 1.171 2000/08/09 11:25:23 cvs Exp $
7c7
< $VERSION = sprintf("%d.%02d", q$Revision: 1.17 $ =~ /(\d+)\.(\d+)/);
---
> $VERSION = sprintf("%d.%02d", q$Revision: 1.171 $ =~ /(\d+)\.(\d+)/);
234c234,235
<     my $netloc = $request->url->host_port;
---
>     my $ru = $request->url;
>     my $netloc = $ru->can('host_port') ? $ru->host_port : $ru->host;

Not all URIs actually have a host_port method defined, and this would
cause my (also modified) WWW::Robot to crash.  However, can() is a
fairly new Perl feature.  I don't think RobotUA should fail on things
like this.

 + Is there a better way to address this?
 + Would it be possible to incorporate this into the standard version?
   I hate having to drag my own patches around ...

-- 
Reinier

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About