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

Is there a way to tell cpan not to use LWP.pm? I looked in MyConfig.pm but didn't see anything specific. I ended up installing it because of a dependency and now cpan always tries to use it first and then takes forever to time out before finally switching to curl. Frustrating!! Using the cpan that comes with Perl 5.10.1 on Solaris 10 SPARC (compiled with the gcc under /usr/sfw/). Thanks!

Update: [tye]'s answer in Re: How do I tell cpan not to use LWP.pm? (UtS,L) is correct! Thanks!!

Elda Taluta; Sarks Sark; Ark Arks

Replies are listed 'Best First'.
Re: How do I tell cpan not to use LWP.pm? (UtS,L)
by tye (Sage) on Feb 19, 2010 at 01:18 UTC

    The source code to CPAN::Nox is:

    package CPAN::Nox; use strict; use vars qw($VERSION @EXPORT); BEGIN{ $CPAN::Suppress_readline=1 unless defined $CPAN::term; } use base 'Exporter'; use CPAN; $VERSION = "5.50"; $CPAN::META->has_inst('Digest::MD5','no'); $CPAN::META->has_inst('LWP','no'); $CPAN::META->has_inst('Compress::Zlib','no'); @EXPORT = @CPAN::EXPORT; *AUTOLOAD = \&CPAN::AUTOLOAD; 1;

    So you probably only need:

    #!/usr/bin/perl use CPAN; $CPAN::META->has_inst('LWP','no'); shell();

    - tye        

      Yep, that did the trick!! Thanks!!

      Elda Taluta; Sarks Sark; Ark Arks

Re: How do I tell cpan not to use LWP.pm?
by Anonymous Monk on Feb 18, 2010 at 23:02 UTC
    untested cpannolwp
    #!/usr/bin/perl -- BEGIN { package LWP; $INC{'LWP.pm'} = __FILE__; package LWP::UserAgent; $INC{'LWP/UserAgent.pm'} = __FILE__; } use File::Which; my $cpan = which 'cpan'; do $cpan;
      Thanks, but cpan still tries to make some calls to LWP which causes the script to error out (since the fuctions don't exist). Nice idea though.

      Elda Taluta; Sarks Sark; Ark Arks