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

I'm behind a fairly strict firewall, and LWP as called by CPAN appears to be too pig headed to use the environment variables I have set up. Wget works fine, but for some reason CPAN won't fall back to wget, it will try a few times with LWP and then give up. How can I make CPAN not use LWP, or how can I force LWP to actually pay attention to small details like the frickin' proxy server?.

TIA,

____________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
Re: How do I make CPAN not use LWP
by zejames (Hermit) on Apr 17, 2002 at 07:48 UTC
    The CPAN modules can be configured several ways. As for the HTTP proxy, you can do it using one of the following method:

    • Personalize you file $HOME/.cpan/CPAN/MyConfig.pm (copy it from the /usr/lib/perl5/your_version/CPAN/Config.pm) with the values you want
    • Once the CPAN shell launched, change the configuration variables with the following command
      # o conf http_proxy http://192.168.0.254:8080/

    Some other variable may interest you (proxy_user, proxy_pass). They can be modified the same way...

    HTM

    zejames
      Your advice seems to indicate that this solution works for you. However, in complete defiance of the usual trend that posters seem to exhibit, I read the manual thoroughly and tried setting all the possible proxies, etc. There is one thing I am doing differently, however:

      I am trying to use basic authentication through the proxy. Wget handles it fine, and LWP ought to as well. My proxy line looks like this: http://user:password@192.168.0.254:8080/

      But as I was going through the source code, I found this:

      # > I note that although CPAN.pm can use proxies, it doesn't seem equ +ipped to # > use ones that require basic autorization.

      Anyway I finally got it to leave LWP alone by commenting out about 500 lines of code. CPAN really seems to be a candidate for "There's Got To Be A Better Way To Do It"

      ____________________
      Jeremy
      I didn't believe in evil until I dated it.

        CPAN really seems to be a candidate for "There's Got To Be A Better Way To Do It"

        There might be: CPANPLUS - or so they say. I still haven't tried it myself, but even if it doesn't handle basic auth etc, this one is at least said to be possible to modify with much greater ease. Maybe it'll work better in this situation. Then agan, maybe not. :)


        You have moved into a dark place.
        It is pitch black. You are likely to be eaten by a grue.

        I'll agree with this. My place of work is firewalled off completely on the FTP ports but open on HTTP, I'd really like CPAN.pm to go and get the modules by HTTP but it didn't seem to want to no matter how I played with it.

        Ah well, let's hope that CPANTS is soon and as good as it's made to sound.

        Hi,

        So, we are talking about pitfalls in CPAN? What about the fact that, when it do not find a readme file, it tries every get method (ranging from LWP to lynx --source) on every mirror on my list?

        I can't even undersstand why trying all methods, if LWP replies with 'the file is not here', then the file is not there and nothing will change y changing the access method... And why trying all mirrors?

        Cheers


        Leo TheHobbit
        GED/CS d? s-:++ a+ C++ UL+++ P+++>+++++ E+ W++ N+ o K? !w O? M V PS+++
        PE-- Y+ PPG+ t++ 5? X-- R+ tv+ b+++ DI? D G++ e*(++++) h r++ y+++(*)
Re: How do I make CPAN not use LWP
by chromatic (Archbishop) on Apr 17, 2002 at 14:40 UTC