URI::URL

F

Fritz Bayer

Hi,

I get the following error:

Can't locate object method "host" via package "URI::_generic"

This error occurs randomly. What't the reason for that?

Fritz
 
F

Fritz Bayer

Gunnar Hjalmarsson said:

Well I already googled quite a bit but it did not help. I have already
updated all the perl libraries.

If the question was not clear enough let me try to repeat this. I'm
basically fetching pages from the web containing links.

Those links I store in URI objects, which I collect in a large list.
This list I later walk though printing out each object calling the
following function:

foreach $uri (@uris)
{
print $uri->host() . "\n";
}

Sometimes I get the error above. If I call the perl script again, on
the same page, then all of a sudden it works.

So it occurs randomly, sometimes and I can't reproduce it. I thought
it has something to do with the network.

But this can't be since the fetching occurs earlier and the call
$uri->hsot() does not involve the network.

In the vey beginning it would not even allow me to call the host()
function, but after updating the modules over the cpan console that
got fixed.

So I really have no clue what it could be. My last thought was, that I
pass in some invalid argument, for ex an invalid URL so that its not
possible to call the host() function?
 
G

Gunnar Hjalmarsson

Fritz said:
Well I already googled quite a bit but it did not help. I have
already updated all the perl libraries.

If the question was not clear enough let me try to repeat this. I'm
basically fetching pages from the web containing links.

Those links I store in URI objects, which I collect in a large
list. This list I later walk though printing out each object
calling the following function:

foreach $uri (@uris)
{
print $uri->host() . "\n";
}

Sometimes I get the error above. If I call the perl script again,
on the same page, then all of a sudden it works.

So it occurs randomly, sometimes and I can't reproduce it. I
thought it has something to do with the network.

But this can't be since the fetching occurs earlier and the call
$uri->hsot() does not involve the network.

In the vey beginning it would not even allow me to call the host()
function, but after updating the modules over the cpan console that
got fixed.

So I really have no clue what it could be. My last thought was,
that I pass in some invalid argument, for ex an invalid URL so that
its not possible to call the host() function?

If you really want to have somebody help you, I suggest that you write
a small but *complete* program that people can copy and run, and that
behaves the way you describe.

You should also note that this group is defunct, with only a handful
readers, so you'd better post the program to comp.lang.perl.misc instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top