develooper Front page | perl.libwww | Postings from November 2002

Re: URI Bug?

Thread Previous | Thread Next
Hans de Graaff
November 23, 2002 09:41
Re: URI Bug?
Message ID:
Hmm, it seems my post got corrupted somehow. Here's what I wrote:

On Thu, 21 Nov 2002, Darby Cacdac wrote:

> Im using the URI (1.22) module and I'm getting the error:
> "Can't locate object method "host" via package "URI::_generic"
> (perhaps you forgot to load "URI::_generic"?) at
> /usr/perl5/site_perl/5.6.1/URI/ line 50."
> It turns out that this error comes up when I'm doing a $url->host on
> a link that looks like this: <a href=3D"httpthrds/index.html">. As
> long as the link starts with http* (aside from http://*) the error
> is triggered.

I think the problem is that host() is only supported for those schemes
that have an authority component (see perldoc URI for more
details). It would be nice if there would be a simple test to
determine which schemes qualify for this. Currently I have this
hardcoded in my application to do this:=20

    $url->host(ip_address($url->host)) if $url->scheme =3D~ /^(https?|ftp|g=

I'd be happy to learn of a better way to do this, and I'm sure my list
is not complete anyway. I don't track new schemes being added, and
this may vary from installation to installation anyway.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About