ZartroidZ has asked for the wisdom of the Perl Monks concerning the following question:

I keep getting the following message when I type in perl -MCPAN -e 'install DBI' or perl -MCPAN -e 'install File::Spec' etc...: 'CPAN::LWP::UserAgent->new dies with Can't locate object method "host" via package "URI::_foreign"'. I don't know what to do to stop this message from popping up (after all, I want to install a load of modules).

Replies are listed 'Best First'.
Re: Installing modules problem:
by kvale (Monsignor) on Oct 11, 2002 at 18:11 UTC
    Typically the CPAN module tries several different methods to connect to the outside world. Try installing from the shell:
    % perl -MCPAN -e shell
    Perhaps it will bypass the problem and try another method.

    -Mark

      The problem still persists (even in the shell)... I keep getting: 'CPAN::LWP::UserAgent->new dies with Can't locate object method "host" via package "URI::_foreign"' as an error.
        after you run in shell mode (perl -MCPAN -e shell) try running o conf init and verify all of the entries, after that do a install Bundle::CPAN and make sure all of the reqs are up to date. I had this same problem and it fixed it for me...

        -Waswas
Re: Installing modules problem:
by fruiture (Curate) on Oct 11, 2002 at 19:44 UTC

    Looks like some URI module is broken. You'll have to install the URI module without CPAN.pm shell, using `make && make test && make install`.

    My URI::_foreign looks like it is deprecated and all functionality is in URI::_generic, for it only require()s that module and puts it into @ISA and nothing more, URI::_generic inherits the "host" method from URI.pm itself. One of those dependencies must be broken...

    --
    http://fruiture.de