This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Updated CPAN.pm to CPAN version 1.94_64
[perl5.git] / cpan / CPAN / lib / CPAN / HandleConfig.pm
1 package CPAN::HandleConfig;
2 use strict;
3 use vars qw(%can %keys $loading $VERSION);
4 use File::Path ();
5 use File::Basename ();
6 use Carp ();
7
8 $VERSION = "5.5002"; # see also CPAN::Config::VERSION at end of file
9
10 %can = (
11         commit   => "Commit changes to disk",
12         defaults => "Reload defaults from disk",
13         help     => "Short help about 'o conf' usage",
14         init     => "Interactive setting of all options",
15 );
16
17 # Q: where is the "How do I add a new config option" HOWTO?
18 # A1: svn diff -r 757:758 # where dagolden added test_report [git e997b71de88f1019a1472fc13cb97b1b7f96610f]
19 # A2: svn diff -r 985:986 # where andk added yaml_module [git 312b6d9b12b1bdec0b6e282d853482145475021f]
20 # A3: 1. add new config option to %keys below
21 #     2. add a Pod description in CPAN::FirstTime; it should include a
22 #        prompt line; see others for examples
23 #     3. add a "matcher" section in CPAN::FirstTime::init that includes
24 #        a prompt function; see others for examples
25 #     4. add config option to documentation section in CPAN.pm
26
27 %keys = map { $_ => undef }
28     (
29      "applypatch",
30      "auto_commit",
31      "build_cache",
32      "build_dir",
33      "build_dir_reuse",
34      "build_requires_install_policy",
35      "bzip2",
36      "cache_metadata",
37      "check_sigs",
38      "colorize_debug",
39      "colorize_output",
40      "colorize_print",
41      "colorize_warn",
42      "commandnumber_in_prompt",
43      "commands_quote",
44      "connect_to_internet_ok",
45      "cpan_home",
46      "curl",
47      "dontload_hash", # deprecated after 1.83_68 (rev. 581)
48      "dontload_list",
49      "ftp",
50      "ftp_passive",
51      "ftp_proxy",
52      "ftpstats_size",
53      "ftpstats_period",
54      "getcwd",
55      "gpg",
56      "gzip",
57      "halt_on_failure",
58      "histfile",
59      "histsize",
60      "http_proxy",
61      "inactivity_timeout",
62      "index_expire",
63      "inhibit_startup_message",
64      "keep_source_where",
65      "load_module_verbosity",
66      "lynx",
67      "make",
68      "make_arg",
69      "make_install_arg",
70      "make_install_make_command",
71      "makepl_arg",
72      "mbuild_arg",
73      "mbuild_install_arg",
74      "mbuild_install_build_command",
75      "mbuildpl_arg",
76      "ncftp",
77      "ncftpget",
78      "no_proxy",
79      "pager",
80      "password",
81      "patch",
82      "patches_dir",
83      "perl5lib_verbosity",
84      "prefer_external_tar",
85      "prefer_installer",
86      "prefs_dir",
87      "prerequisites_policy",
88      "proxy_pass",
89      "proxy_user",
90      "randomize_urllist",
91      "scan_cache",
92      "shell",
93      "show_unparsable_versions",
94      "show_upload_date",
95      "show_zero_versions",
96      "tar",
97      "tar_verbosity",
98      "term_is_latin",
99      "term_ornaments",
100      "test_report",
101      "trust_test_report_history",
102      "unzip",
103      "urllist",
104      "use_sqlite",
105      "username",
106      "version_timeout",
107      "wait_list",
108      "wget",
109      "yaml_load_code",
110      "yaml_module",
111     );
112
113 my %prefssupport = map { $_ => 1 }
114     (
115      "build_requires_install_policy",
116      "check_sigs",
117      "make",
118      "make_install_make_command",
119      "prefer_installer",
120      "test_report",
121     );
122
123 # returns true on successful action
124 sub edit {
125     my($self,@args) = @_;
126     return unless @args;
127     CPAN->debug("self[$self]args[".join(" | ",@args)."]");
128     my($o,$str,$func,$args,$key_exists);
129     $o = shift @args;
130     if($can{$o}) {
131         my $success = $self->$o(args => \@args); # o conf init => sub init => sub load
132         unless ($success) {
133             die "Panic: could not configure CPAN.pm for args [@args]. Giving up.";
134         }
135     } else {
136         CPAN->debug("o[$o]") if $CPAN::DEBUG;
137         unless (exists $keys{$o}) {
138             $CPAN::Frontend->mywarn("Warning: unknown configuration variable '$o'\n");
139         }
140         my $changed;
141
142
143         # one day I used randomize_urllist for a boolean, so we must
144         # list them explicitly --ak
145         if (0) {
146         } elsif ($o =~ /^(wait_list|urllist|dontload_list)$/) {
147
148             #
149             # ARRAYS
150             #
151
152             $func = shift @args;
153             $func ||= "";
154             CPAN->debug("func[$func]args[@args]") if $CPAN::DEBUG;
155             # Let's avoid eval, it's easier to comprehend without.
156             if ($func eq "push") {
157                 push @{$CPAN::Config->{$o}}, @args;
158                 $changed = 1;
159             } elsif ($func eq "pop") {
160                 pop @{$CPAN::Config->{$o}};
161                 $changed = 1;
162             } elsif ($func eq "shift") {
163                 shift @{$CPAN::Config->{$o}};
164                 $changed = 1;
165             } elsif ($func eq "unshift") {
166                 unshift @{$CPAN::Config->{$o}}, @args;
167                 $changed = 1;
168             } elsif ($func eq "splice") {
169                 my $offset = shift @args || 0;
170                 my $length = shift @args || 0;
171                 splice @{$CPAN::Config->{$o}}, $offset, $length, @args; # may warn
172                 $changed = 1;
173             } elsif ($func) {
174                 $CPAN::Config->{$o} = [$func, @args];
175                 $changed = 1;
176             } else {
177                 $self->prettyprint($o);
178             }
179             if ($changed) {
180                 if ($o eq "urllist") {
181                     # reset the cached values
182                     undef $CPAN::FTP::Thesite;
183                     undef $CPAN::FTP::Themethod;
184                     $CPAN::Index::LAST_TIME = 0;
185                 } elsif ($o eq "dontload_list") {
186                     # empty it, it will be built up again
187                     $CPAN::META->{dontload_hash} = {};
188                 }
189             }
190         } elsif ($o =~ /_hash$/) {
191
192             #
193             # HASHES
194             #
195
196             if (@args==1 && $args[0] eq "") {
197                 @args = ();
198             } elsif (@args % 2) {
199                 push @args, "";
200             }
201             $CPAN::Config->{$o} = { @args };
202             $changed = 1;
203         } else {
204
205             #
206             # SCALARS
207             #
208
209             if (defined $args[0]) {
210                 $CPAN::CONFIG_DIRTY = 1;
211                 $CPAN::Config->{$o} = $args[0];
212                 $changed = 1;
213             }
214             $self->prettyprint($o)
215                 if exists $keys{$o} or defined $CPAN::Config->{$o};
216         }
217         if ($changed) {
218             if ($CPAN::Config->{auto_commit}) {
219                 $self->commit;
220             } else {
221                 $CPAN::CONFIG_DIRTY = 1;
222                 $CPAN::Frontend->myprint("Please use 'o conf commit' to ".
223                                          "make the config permanent!\n\n");
224             }
225         }
226     }
227 }
228
229 sub prettyprint {
230     my($self,$k) = @_;
231     my $v = $CPAN::Config->{$k};
232     if (ref $v) {
233         my(@report);
234         if (ref $v eq "ARRAY") {
235             @report = map {"\t$_ \[$v->[$_]]\n"} 0..$#$v;
236         } else {
237             @report = map
238                 {
239                     sprintf "\t%-18s => %s\n",
240                                "[$_]",
241                                         defined $v->{$_} ? "[$v->{$_}]" : "undef"
242                 } keys %$v;
243         }
244         $CPAN::Frontend->myprint(
245                                  join(
246                                       "",
247                                       sprintf(
248                                               "    %-18s\n",
249                                               $k
250                                              ),
251                                       @report
252                                      )
253                                 );
254     } elsif (defined $v) {
255         $CPAN::Frontend->myprint(sprintf "    %-18s [%s]\n", $k, $v);
256     } else {
257         $CPAN::Frontend->myprint(sprintf "    %-18s undef\n", $k);
258     }
259 }
260
261 # generally, this should be called without arguments so that the currently
262 # loaded config file is where changes are committed.
263 sub commit {
264     my($self,@args) = @_;
265     CPAN->debug("args[@args]") if $CPAN::DEBUG;
266     if ($CPAN::RUN_DEGRADED) {
267                              $CPAN::Frontend->mydie(
268                                                     "'o conf commit' disabled in ".
269                                                     "degraded mode. Maybe try\n".
270                                                     " !undef \$CPAN::RUN_DEGRADED\n"
271                                                    );
272     }
273     my ($configpm, $must_reload);
274
275     # XXX does anything do this? can it be simplified? -- dagolden, 2011-01-19
276     if (@args) {
277       if ($args[0] eq "args") {
278         # we have not signed that contract
279       } else {
280         $configpm = $args[0];
281       }
282     }
283
284     # use provided name or the current config or create a new MyConfig
285     $configpm ||= require_myconfig_or_config() || make_new_config();
286
287     # commit to MyConfig if we can't write to Config
288     if ( ! -w $configpm && $configpm =~ m{CPAN/Config\.pm} ) {
289         my $myconfig = _new_config_name();
290         $CPAN::Frontend->mywarn(
291             "Your $configpm file\n".
292             "is not writable. I will attempt to write your configuration to\n" .
293             "$myconfig instead.\n\n"
294         );
295         $configpm = make_new_config();
296         $must_reload++; # so it gets loaded as $INC{'CPAN/MyConfig.pm'}
297     }
298
299     # XXX why not just "-w $configpm"? -- dagolden, 2011-01-19
300     my($mode);
301     if (-f $configpm) {
302         $mode = (stat $configpm)[2];
303         if ($mode && ! -w _) {
304             _die_cant_write_config($configpm);
305         }
306     }
307
308     $self->_write_config_file($configpm);
309     require_myconfig_or_config() if $must_reload;
310
311     #$mode = 0444 | ( $mode & 0111 ? 0111 : 0 );
312     #chmod $mode, $configpm;
313 ###why was that so?    $self->defaults;
314     $CPAN::Frontend->myprint("commit: wrote '$configpm'\n");
315     $CPAN::CONFIG_DIRTY = 0;
316     1;
317 }
318
319 sub _write_config_file {
320     my ($self, $configpm) = @_;
321     my $msg;
322     $msg = <<EOF if $configpm =~ m{CPAN/Config\.pm};
323
324 # This is CPAN.pm's systemwide configuration file. This file provides
325 # defaults for users, and the values can be changed in a per-user
326 # configuration file.
327
328 EOF
329     $msg ||= "\n";
330     my($fh) = FileHandle->new;
331     rename $configpm, "$configpm~" if -f $configpm;
332     open $fh, ">$configpm" or
333         $CPAN::Frontend->mydie("Couldn't open >$configpm: $!");
334     $fh->print(qq[$msg\$CPAN::Config = \{\n]);
335     foreach (sort keys %$CPAN::Config) {
336         unless (exists $keys{$_}) {
337             # do not drop them: forward compatibility!
338             $CPAN::Frontend->mywarn("Unknown config variable '$_'\n");
339             next;
340         }
341         $fh->print(
342             "  '$_' => ",
343             $self->neatvalue($CPAN::Config->{$_}),
344             ",\n"
345         );
346     }
347     $fh->print("};\n1;\n__END__\n");
348     close $fh;
349
350     return;
351 }
352
353
354 # stolen from MakeMaker; not taking the original because it is buggy;
355 # bugreport will have to say: keys of hashes remain unquoted and can
356 # produce syntax errors
357 sub neatvalue {
358     my($self, $v) = @_;
359     return "undef" unless defined $v;
360     my($t) = ref $v;
361     unless ($t) {
362         $v =~ s/\\/\\\\/g;
363         return "q[$v]";
364     }
365     if ($t eq 'ARRAY') {
366         my(@m, @neat);
367         push @m, "[";
368         foreach my $elem (@$v) {
369             push @neat, "q[$elem]";
370         }
371         push @m, join ", ", @neat;
372         push @m, "]";
373         return join "", @m;
374     }
375     return "$v" unless $t eq 'HASH';
376     my(@m, $key, $val);
377     while (($key,$val) = each %$v) {
378         last unless defined $key; # cautious programming in case (undef,undef) is true
379         push(@m,"q[$key]=>".$self->neatvalue($val)) ;
380     }
381     return "{ ".join(', ',@m)." }";
382 }
383
384 sub defaults {
385     my($self) = @_;
386     if ($CPAN::RUN_DEGRADED) {
387                              $CPAN::Frontend->mydie(
388                                                     "'o conf defaults' disabled in ".
389                                                     "degraded mode. Maybe try\n".
390                                                     " !undef \$CPAN::RUN_DEGRADED\n"
391                                                    );
392     }
393     my $done;
394     for my $config (qw(CPAN/MyConfig.pm CPAN/Config.pm)) {
395         if ($INC{$config}) {
396             CPAN->debug("INC{'$config'}[$INC{$config}]") if $CPAN::DEBUG;
397             CPAN::Shell->_reload_this($config,{reloforce => 1});
398             $CPAN::Frontend->myprint("'$INC{$config}' reread\n");
399             last;
400         }
401     }
402     $CPAN::CONFIG_DIRTY = 0;
403     1;
404 }
405
406 =head2 C<< CLASS->safe_quote ITEM >>
407
408 Quotes an item to become safe against spaces
409 in shell interpolation. An item is enclosed
410 in double quotes if:
411
412   - the item contains spaces in the middle
413   - the item does not start with a quote
414
415 This happens to avoid shell interpolation
416 problems when whitespace is present in
417 directory names.
418
419 This method uses C<commands_quote> to determine
420 the correct quote. If C<commands_quote> is
421 a space, no quoting will take place.
422
423
424 if it starts and ends with the same quote character: leave it as it is
425
426 if it contains no whitespace: leave it as it is
427
428 if it contains whitespace, then
429
430 if it contains quotes: better leave it as it is
431
432 else: quote it with the correct quote type for the box we're on
433
434 =cut
435
436 {
437     # Instead of patching the guess, set commands_quote
438     # to the right value
439     my ($quotes,$use_quote)
440         = $^O eq 'MSWin32'
441             ? ('"', '"')
442                 : (q{"'}, "'")
443                     ;
444
445     sub safe_quote {
446         my ($self, $command) = @_;
447         # Set up quote/default quote
448         my $quote = $CPAN::Config->{commands_quote} || $quotes;
449
450         if ($quote ne ' '
451             and defined($command )
452             and $command =~ /\s/
453             and $command !~ /[$quote]/) {
454             return qq<$use_quote$command$use_quote>
455         }
456         return $command;
457     }
458 }
459
460 sub init {
461     my($self,@args) = @_;
462     CPAN->debug("self[$self]args[".join(",",@args)."]");
463     $self->load(do_init => 1, @args);
464     1;
465 }
466
467 # Loads CPAN::MyConfig or fall-back to CPAN::Config. Will not reload a file
468 # if already loaded. Returns the path to the file %INC or else the empty string
469 #
470 # Note -- if CPAN::Config were loaded and CPAN::MyConfig subsequently
471 # created, calling this again will leave *both* in %INC
472
473 sub require_myconfig_or_config () {
474     if (   $INC{"CPAN/MyConfig.pm"} || _try_loading("CPAN::MyConfig", cpan_home())) {
475         return $INC{"CPAN/MyConfig.pm"};
476             }
477     elsif ( $INC{"CPAN/Config.pm"} || _try_loading("CPAN::Config") ) {
478         return $INC{"CPAN/Config.pm"};
479         }
480     else {
481         return q{};
482         }
483 }
484
485 # Load a module, but ignore "can't locate..." errors
486 # Optionally take a list of directories to add to @INC for the load
487 sub _try_loading {
488     my ($module, @dirs) = @_;
489     (my $file = $module) =~ s{::}{/}g;
490     $file .= ".pm";
491
492     local @INC = @INC;
493     for my $dir ( @dirs ) {
494         if ( -f File::Spec->catfile($dir, $file) ) {
495             unshift @INC, $dir;
496             last;
497     }
498       }
499
500     eval { require $file };
501     my $err_myconfig = $@;
502     if ($err_myconfig and $err_myconfig !~ m#locate \Q$file\E#) {
503         die "Error while requiring ${module}:\n$err_myconfig";
504     }
505     return $INC{$file};
506 }
507
508 # prioritized list of possible places for finding "CPAN/MyConfig.pm"
509 sub cpan_home_dir_candidates {
510     my @dirs;
511     my $old_v = $CPAN::Config->{load_module_verbosity};
512     $CPAN::Config->{load_module_verbosity} = q[none];
513     if ($CPAN::META->has_usable('File::HomeDir')) {
514         if ($^O ne 'darwin') {
515             push @dirs, File::HomeDir->my_data;
516             # my_data is ~/Library/Application Support on darwin,
517                                             # which causes issues in the toolchain.
518         }
519         push @dirs, File::HomeDir->my_home;
520     }
521     push @dirs, $ENV{HOME};
522     $CPAN::Config->{load_module_verbosity} = $old_v;
523     @dirs = map { "$_/.cpan" } @dirs;
524     return wantarray ? @dirs : $dirs[0];
525 }
526
527 sub load {
528     my($self, %args) = @_;
529     $CPAN::Be_Silent+=0; # protect against 'used only once'
530     $CPAN::Be_Silent++ if $args{be_silent}; # do not use; planned to be removed in 2011
531     my $do_init = delete $args{do_init} || 0;
532     my $make_myconfig = delete $args{make_myconfig};
533     $loading = 0 unless defined $loading;
534
535     my $configpm = require_myconfig_or_config;
536     my @miss = $self->missing_config_data;
537     CPAN->debug("do_init[$do_init]loading[$loading]miss[@miss]") if $CPAN::DEBUG;
538     return unless $do_init || @miss;
539
540     # I'm not how we'd ever wind up in a recursive loop, but I'm leaving
541     # this here for safety's sake -- dagolden, 2011-01-19
542     return if $loading;
543     local $loading = ($loading||0) + 1;
544
545     # Warn if we have a config file, but things were found missing
546     if ($configpm && @miss && !$do_init) {
547         if ($make_myconfig || ( ! -w $configpm && $configpm =~ m{CPAN/Config\.pm})) {
548             $configpm = make_new_config();
549             $CPAN::Frontend->myprint(<<END);
550 The system CPAN configuration file has provided some default values,
551 but you need to complete the configuration dialog for CPAN.pm.
552 Configuration will be written to
553  <<$configpm>>
554 END
555         }
556         else {
557             $CPAN::Frontend->myprint(<<END);
558 Sorry, we have to rerun the configuration dialog for CPAN.pm due to
559 some missing parameters. Configuration will be written to
560  <<$configpm>>
561
562 END
563         }
564     }
565
566     require CPAN::FirstTime;
567     return CPAN::FirstTime::init($configpm || make_new_config(), %args);
568 }
569
570 # Creates a new, empty config file at the preferred location
571 # Any existing will be renamed with a ".bak" suffix if possible
572 # If the file cannot be created, an exception is thrown
573 sub make_new_config {
574     my $configpm = _new_config_name();
575     my $configpmdir = File::Basename::dirname( $configpm );
576     File::Path::mkpath($configpmdir) unless -d $configpmdir;
577
578     if ( -w $configpmdir ) {
579         #_#_# following code dumped core on me with 5.003_11, a.k.
580         if( -f $configpm ) {
581             my $configpm_bak = "$configpm.bak";
582             unlink $configpm_bak if -f $configpm_bak;
583             if( rename $configpm, $configpm_bak ) {
584                 $CPAN::Frontend->mywarn(<<END);
585 Old configuration file $configpm
586     moved to $configpm_bak
587 END
588     }
589         }
590         my $fh = FileHandle->new;
591         if ($fh->open(">$configpm")) {
592             $fh->print("1;\n");
593             return $configpm;
594         }
595     }
596     _die_cant_write_config($configpm);
597 }
598
599 sub _die_cant_write_config {
600     my ($configpm) = @_;
601     $CPAN::Frontend->mydie(<<"END");
602 WARNING: CPAN.pm is unable to write a configuration file.  You
603 must be able to create and write to '$configpm'.
604
605 Aborting configuration.
606 END
607
608 }
609
610 # From candidate directories, we would like (in descending preference order):
611 #   * the one that contains a MyConfig file
612 #   * one that exists (even without MyConfig)
613 #   * the first one on the list
614 sub cpan_home {
615     my @dirs = cpan_home_dir_candidates();
616     for my $d (@dirs) {
617         return $d if -f "$d/CPAN/MyConfig.pm";
618     }
619     for my $d (@dirs) {
620         return $d if -d $d;
621     }
622     return $dirs[0];
623 }
624
625 sub _new_config_name {
626     return File::Spec->catfile(cpan_home(), 'CPAN', 'MyConfig.pm');
627 }
628
629 # returns mandatory but missing entries in the Config
630 sub missing_config_data {
631     my(@miss);
632     for (
633          "auto_commit",
634          "build_cache",
635          "build_dir",
636          "cache_metadata",
637          "cpan_home",
638          "ftp_proxy",
639          #"gzip",
640          "http_proxy",
641          "index_expire",
642          #"inhibit_startup_message",
643          "keep_source_where",
644          #"make",
645          "make_arg",
646          "make_install_arg",
647          "makepl_arg",
648          "mbuild_arg",
649          "mbuild_install_arg",
650          ($^O eq "MSWin32" ? "" : "mbuild_install_build_command"),
651          "mbuildpl_arg",
652          "no_proxy",
653          #"pager",
654          "prerequisites_policy",
655          "scan_cache",
656          #"tar",
657          #"unzip",
658          "urllist",
659         ) {
660         next unless exists $keys{$_};
661         push @miss, $_ unless defined $CPAN::Config->{$_};
662     }
663     return @miss;
664 }
665
666 sub help {
667     $CPAN::Frontend->myprint(q[
668 Known options:
669   commit    commit session changes to disk
670   defaults  reload default config values from disk
671   help      this help
672   init      enter a dialog to set all or a set of parameters
673
674 Edit key values as in the following (the "o" is a literal letter o):
675   o conf build_cache 15
676   o conf build_dir "/foo/bar"
677   o conf urllist shift
678   o conf urllist unshift ftp://ftp.foo.bar/
679   o conf inhibit_startup_message 1
680
681 ]);
682     1; #don't reprint CPAN::Config
683 }
684
685 sub cpl {
686     my($word,$line,$pos) = @_;
687     $word ||= "";
688     CPAN->debug("word[$word] line[$line] pos[$pos]") if $CPAN::DEBUG;
689     my(@words) = split " ", substr($line,0,$pos+1);
690     if (
691         defined($words[2])
692         and
693         $words[2] =~ /list$/
694         and
695         (
696         @words == 3
697         ||
698         @words == 4 && length($word)
699         )
700        ) {
701         return grep /^\Q$word\E/, qw(splice shift unshift pop push);
702     } elsif (defined($words[2])
703              and
704              $words[2] eq "init"
705              and
706             (
707              @words == 3
708              ||
709              @words >= 4 && length($word)
710             )) {
711         return sort grep /^\Q$word\E/, keys %keys;
712     } elsif (@words >= 4) {
713         return ();
714     }
715     my %seen;
716     my(@o_conf) =  sort grep { !$seen{$_}++ }
717         keys %can,
718             keys %$CPAN::Config,
719                 keys %keys;
720     return grep /^\Q$word\E/, @o_conf;
721 }
722
723 sub prefs_lookup {
724     my($self,$distro,$what) = @_;
725
726     if ($prefssupport{$what}) {
727         return $CPAN::Config->{$what} unless
728             $distro
729                 and $distro->prefs
730                     and $distro->prefs->{cpanconfig}
731                         and defined $distro->prefs->{cpanconfig}{$what};
732         return $distro->prefs->{cpanconfig}{$what};
733     } else {
734         $CPAN::Frontend->mywarn("Warning: $what not yet officially ".
735                                 "supported for distroprefs, doing a normal lookup");
736         return $CPAN::Config->{$what};
737     }
738 }
739
740
741 {
742     package
743         CPAN::Config; ####::###### #hide from indexer
744     # note: J. Nick Koston wrote me that they are using
745     # CPAN::Config->commit although undocumented. I suggested
746     # CPAN::Shell->o("conf","commit") even when ugly it is at least
747     # documented
748
749     # that's why I added the CPAN::Config class with autoload and
750     # deprecated warning
751
752     use strict;
753     use vars qw($AUTOLOAD $VERSION);
754     $VERSION = "5.5001";
755
756     # formerly CPAN::HandleConfig was known as CPAN::Config
757     sub AUTOLOAD { ## no critic
758         my $class = shift; # e.g. in dh-make-perl: CPAN::Config
759         my($l) = $AUTOLOAD;
760         $CPAN::Frontend->mywarn("Dispatching deprecated method '$l' to CPAN::HandleConfig\n");
761         $l =~ s/.*:://;
762         CPAN::HandleConfig->$l(@_);
763     }
764 }
765
766 1;
767
768 __END__
769
770 =head1 LICENSE
771
772 This program is free software; you can redistribute it and/or
773 modify it under the same terms as Perl itself.
774
775 =cut
776
777 # Local Variables:
778 # mode: cperl
779 # cperl-indent-level: 4
780 # End:
781 # vim: ts=4 sts=4 sw=4: