For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2007 > Re: CPAN shell (LWP, Net::FTP) won't authenticate properly









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: CPAN shell (LWP, Net::FTP) won't authenticate properly
Tom Phoenix

2007-06-25, 9:59 pm

On 6/25/07, RICHARD FERNANDEZ <rfernandez@arrow.com> wrote:

> I'm trying to use the CPAN shell to install some modules from our
> internal CPAN mirror.
> I'm using a URL of the form ftp://MyCpanMirror/u02/CPAN/ , and I have a
> valid .netrc configured with a user and password for the mirror box.
>
> At first I was able to query/install modules easily, but then I did an
> "install Bundle::CPAN", and now I can't log into my CPAN mirror. To be
> specific, LWP and Net::FTP are attempting to use an anonymous login,
> which is not allowed, instead of trying to log in via the user
> information contained in .netrc.


Sounds like somebody goofed, and assumed that all CPAN mirrors allow
anonymous access. You probably need to file a bug report, but let's
see how far we can get first.

It's undocumented, but maybe try this:

BEGIN { $CPAN::DEBUG = 512; } # FTP?

> I've read the docs for CPAN, LWP::UserAgent, and Net::FTP, but I don't
> see how to change this behavior. I was under the impression that if a
> .netrc was available, Net::FTP at least, would use it for
> authentication.


That's my impression as well. Does Net::Netrc work for you from the
command line, maybe something like this?

perl -MNet::Netrc -lwe 'print join " ",
Net::Netrc->lookup("MyCpanMirror")->lpa'

If you're still able to use the ftp command to manually log in to your
mirror, you should be able to configure CPAN to use that, as a
workaround. I say you should, but I don't know how tenaciously it may
try to use Net::FTP (or whatever is broken) instead.

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training
Richard Fernandez

2007-06-25, 9:59 pm

Hi Tom,

Thanks for the response.=20

> It's undocumented, but maybe try this:
>=20
> BEGIN { $CPAN::DEBUG =3D 512; } # FTP?
>=20


Not sure where to plug in this BEGIN {}...



> perl -MNet::Netrc -lwe 'print join " ",=20
> Net::Netrc->lookup("MyCpanMirror")->lpa'
>


It looks like Net::Netrc is working:
# perl -MNet::Netrc -lwe 'print join(" ",
Net::Netrc->lookup("MyCpanMirror")->lpa)'
Use of uninitialized value in join or string at -e line 1.
cpan XpasswdX=20

I've also tested Net::FTP separately, and it works as advertised with
..netrc.
=20
> If you're still able to use the ftp command to manually log=20
> in to your mirror, you should be able to configure CPAN to=20
> use that, as a workaround. I say you should, but I don't know=20
> how tenaciously it may try to use Net::FTP (or whatever is=20
> broken) instead.
>=20


As it turns out, if I wait patiently for all the LWP/Net::FTP timeouts,
eventually CPAN resorts to /usr/bin/ftp which does read my .netrc. My
modules do eventually get installed but not w/o several admonitions that
using /usr/bin/ftp may cause "...problems that are hard to diagnose"

I'm not sure where else to go with this. It looks like I can eventually
get what I need installed, but not without a long bumpy ride first.

Thanks for the feedback.
Mumia W.

2007-06-26, 7:59 am

On 06/25/2007 12:40 PM, RICHARD FERNANDEZ wrote:
> [...]
> I'm not sure where else to go with this. It looks like I can eventually
> get what I need installed, but not without a long bumpy ride first.
> [...]


A nice feature for someone to add to CPAN.pm would be the option to set
the preferred ftp option.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com