[perl #24691] leading spaces on cpan configuration causes failure
[p5sagit/p5-mst-13.2.git] / lib / CPAN / FirstTime.pm
1 # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
2 package CPAN::Mirrored::By;
3
4 sub new { 
5     my($self,@arg) = @_;
6     bless [@arg], $self;
7 }
8 sub continent { shift->[0] }
9 sub country { shift->[1] }
10 sub url { shift->[2] }
11
12 package CPAN::FirstTime;
13
14 use strict;
15 use ExtUtils::MakeMaker ();
16 use FileHandle ();
17 use File::Basename ();
18 use File::Path ();
19 use File::Spec;
20 use vars qw($VERSION);
21 $VERSION = substr q$Revision: 1.60 $, 10;
22
23 =head1 NAME
24
25 CPAN::FirstTime - Utility for CPAN::Config file Initialization
26
27 =head1 SYNOPSIS
28
29 CPAN::FirstTime::init()
30
31 =head1 DESCRIPTION
32
33 The init routine asks a few questions and writes a CPAN::Config
34 file. Nothing special.
35
36 =cut
37
38
39 sub init {
40     my($configpm) = @_;
41     use Config;
42     unless ($CPAN::VERSION) {
43         require CPAN::Nox;
44     }
45     eval {require CPAN::Config;};
46     $CPAN::Config ||= {};
47     local($/) = "\n";
48     local($\) = "";
49     local($|) = 1;
50
51     my($ans,$default);
52
53     #
54     # Files, directories
55     #
56
57     print qq[
58
59 CPAN is the world-wide archive of perl resources. It consists of about
60 100 sites that all replicate the same contents all around the globe.
61 Many countries have at least one CPAN site already. The resources
62 found on CPAN are easily accessible with the CPAN.pm module. If you
63 want to use CPAN.pm, you have to configure it properly.
64
65 If you do not want to enter a dialog now, you can answer 'no' to this
66 question and I\'ll try to autoconfigure. (Note: you can revisit this
67 dialog anytime later by typing 'o conf init' at the cpan prompt.)
68
69 ];
70
71     my $manual_conf = prompt("Are you ready for manual configuration?", "yes");
72     my $fastread;
73     {
74       if ($manual_conf =~ /^y/i) {
75         $fastread = 0;
76       } else {
77         $fastread = 1;
78         $CPAN::Config->{urllist} ||= [];
79
80         local $^W = 0;
81         # prototype should match that of &MakeMaker::prompt
82         *_real_prompt = sub ($;$) {
83           my($q,$a) = @_;
84           my($ret) = defined $a ? $a : "";
85           printf qq{%s [%s]\n\n}, $q, $ret;
86
87           $ret;
88         };
89       }
90     }
91     print qq{
92
93 The following questions are intended to help you with the
94 configuration. The CPAN module needs a directory of its own to cache
95 important index files and maybe keep a temporary mirror of CPAN files.
96 This may be a site-wide directory or a personal directory.
97
98 };
99
100     my $cpan_home = $CPAN::Config->{cpan_home} || File::Spec->catdir($ENV{HOME}, ".cpan");
101     if (-d $cpan_home) {
102         print qq{
103
104 I see you already have a  directory
105     $cpan_home
106 Shall we use it as the general CPAN build and cache directory?
107
108 };
109     } else {
110         print qq{
111
112 First of all, I\'d like to create this directory. Where?
113
114 };
115     }
116
117     $default = $cpan_home;
118     while ($ans = prompt("CPAN build and cache directory?",$default)) {
119       unless (File::Spec->file_name_is_absolute($ans)) {
120         require Cwd;
121         my $cwd = Cwd::cwd();
122         my $absans = File::Spec->catdir($cwd,$ans);
123         warn "The path '$ans' is not an absolute path. Please specify an absolute path\n";
124         $default = $absans;
125         next;
126       }
127       eval { File::Path::mkpath($ans); }; # dies if it can't
128       if ($@) {
129         warn "Couldn't create directory $ans.
130 Please retry.\n";
131         next;
132       }
133       if (-d $ans && -w _) {
134         last;
135       } else {
136         warn "Couldn't find directory $ans
137   or directory is not writable. Please retry.\n";
138       }
139     }
140     $CPAN::Config->{cpan_home} = $ans;
141
142     print qq{
143
144 If you want, I can keep the source files after a build in the cpan
145 home directory. If you choose so then future builds will take the
146 files from there. If you don\'t want to keep them, answer 0 to the
147 next question.
148
149 };
150
151     $CPAN::Config->{keep_source_where} = File::Spec->catdir($CPAN::Config->{cpan_home},"sources");
152     $CPAN::Config->{build_dir} = File::Spec->catdir($CPAN::Config->{cpan_home},"build");
153
154     #
155     # Cache size, Index expire
156     #
157
158     print qq{
159
160 How big should the disk cache be for keeping the build directories
161 with all the intermediate files\?
162
163 };
164
165     $default = $CPAN::Config->{build_cache} || 10;
166     $ans = prompt("Cache size for build directory (in MB)?", $default);
167     $CPAN::Config->{build_cache} = $ans;
168
169     # XXX This the time when we refetch the index files (in days)
170     $CPAN::Config->{'index_expire'} = 1;
171
172     print qq{
173
174 By default, each time the CPAN module is started, cache scanning
175 is performed to keep the cache size in sync. To prevent from this,
176 disable the cache scanning with 'never'.
177
178 };
179
180     $default = $CPAN::Config->{scan_cache} || 'atstart';
181     do {
182         $ans = prompt("Perform cache scanning (atstart or never)?", $default);
183     } while ($ans ne 'atstart' && $ans ne 'never');
184     $CPAN::Config->{scan_cache} = $ans;
185
186     #
187     # cache_metadata
188     #
189     print qq{
190
191 To considerably speed up the initial CPAN shell startup, it is
192 possible to use Storable to create a cache of metadata. If Storable
193 is not available, the normal index mechanism will be used.
194
195 };
196
197     defined($default = $CPAN::Config->{cache_metadata}) or $default = 1;
198     do {
199         $ans = prompt("Cache metadata (yes/no)?", ($default ? 'yes' : 'no'));
200     } while ($ans !~ /^[yn]/i);
201     $CPAN::Config->{cache_metadata} = ($ans =~ /^y/i ? 1 : 0);
202
203     #
204     # term_is_latin
205     #
206     print qq{
207
208 The next option deals with the charset your terminal supports. In
209 general CPAN is English speaking territory, thus the charset does not
210 matter much, but some of the aliens out there who upload their
211 software to CPAN bear names that are outside the ASCII range. If your
212 terminal supports UTF-8, you say no to the next question, if it
213 supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it
214 supports neither nor, your answer does not matter, you will not be
215 able to read the names of some authors anyway. If you answer no, names
216 will be output in UTF-8.
217
218 };
219
220     defined($default = $CPAN::Config->{term_is_latin}) or $default = 1;
221     do {
222         $ans = prompt("Your terminal expects ISO-8859-1 (yes/no)?",
223                       ($default ? 'yes' : 'no'));
224     } while ($ans !~ /^[yn]/i);
225     $CPAN::Config->{term_is_latin} = ($ans =~ /^y/i ? 1 : 0);
226
227     #
228     # save history in file histfile
229     #
230     print qq{
231
232 If you have one of the readline packages (Term::ReadLine::Perl,
233 Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
234 shell will have history support. The next two questions deal with the
235 filename of the history file and with its size. If you do not want to
236 set this variable, please hit SPACE RETURN to the following question.
237
238 };
239
240     defined($default = $CPAN::Config->{histfile}) or
241         $default = File::Spec->catfile($CPAN::Config->{cpan_home},"histfile");
242     $ans = prompt("File to save your history?", $default);
243     $CPAN::Config->{histfile} = $ans;
244
245     if ($CPAN::Config->{histfile}) {
246       defined($default = $CPAN::Config->{histsize}) or $default = 100;
247       $ans = prompt("Number of lines to save?", $default);
248       $CPAN::Config->{histsize} = $ans;
249     }
250
251     #
252     # prerequisites_policy
253     # Do we follow PREREQ_PM?
254     #
255     print qq{
256
257 The CPAN module can detect when a module that which you are trying to
258 build depends on prerequisites. If this happens, it can build the
259 prerequisites for you automatically ('follow'), ask you for
260 confirmation ('ask'), or just ignore them ('ignore'). Please set your
261 policy to one of the three values.
262
263 };
264
265     $default = $CPAN::Config->{prerequisites_policy} || 'ask';
266     do {
267       $ans =
268           prompt("Policy on building prerequisites (follow, ask or ignore)?",
269                  $default);
270     } while ($ans ne 'follow' && $ans ne 'ask' && $ans ne 'ignore');
271     $CPAN::Config->{prerequisites_policy} = $ans;
272
273     #
274     # External programs
275     #
276
277     print qq{
278
279 The CPAN module will need a few external programs to work properly.
280 Please correct me, if I guess the wrong path for a program. Don\'t
281 panic if you do not have some of them, just press ENTER for those. To
282 disable the use of a download program, you can type a space followed
283 by ENTER.
284
285 };
286
287     my $old_warn = $^W;
288     local $^W if $^O eq 'MacOS';
289     my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'};
290     local $^W = $old_warn;
291     my $progname;
292     for $progname (qw/gzip tar unzip make lynx wget ncftpget ncftp ftp gpg/){
293       if ($^O eq 'MacOS') {
294           $CPAN::Config->{$progname} = 'not_here';
295           next;
296       }
297       my $progcall = $progname;
298       # we don't need ncftp if we have ncftpget
299       next if $progname eq "ncftp" && $CPAN::Config->{ncftpget} gt " ";
300       my $path = $CPAN::Config->{$progname} 
301           || $Config::Config{$progname}
302               || "";
303       if (File::Spec->file_name_is_absolute($path)) {
304         # testing existence is not good enough, some have these exe
305         # extensions
306
307         # warn "Warning: configured $path does not exist\n" unless -e $path;
308         # $path = "";
309       } else {
310         $path = '';
311       }
312       unless ($path) {
313         # e.g. make -> nmake
314         $progcall = $Config::Config{$progname} if $Config::Config{$progname};
315       }
316
317       $path ||= find_exe($progcall,[@path]);
318       warn "Warning: $progcall not found in PATH\n" unless
319           $path; # not -e $path, because find_exe already checked that
320       $ans = prompt("Where is your $progname program?",$path) || $path;
321       $CPAN::Config->{$progname} = $ans;
322     }
323     my $path = $CPAN::Config->{'pager'} || 
324         $ENV{PAGER} || find_exe("less",[@path]) || 
325             find_exe("more",[@path]) || ($^O eq 'MacOS' ? $ENV{EDITOR} : 0 )
326             || "more";
327     $ans = prompt("What is your favorite pager program?",$path);
328     $CPAN::Config->{'pager'} = $ans;
329     $path = $CPAN::Config->{'shell'};
330     if (File::Spec->file_name_is_absolute($path)) {
331         warn "Warning: configured $path does not exist\n" unless -e $path;
332         $path = "";
333     }
334     $path ||= $ENV{SHELL};
335     if ($^O eq 'MacOS') {
336         $CPAN::Config->{'shell'} = 'not_here';
337     } else {
338         $path =~ s,\\,/,g if $^O eq 'os2';      # Cosmetic only
339         $ans = prompt("What is your favorite shell?",$path);
340         $CPAN::Config->{'shell'} = $ans;
341     }
342
343     #
344     # Arguments to make etc.
345     #
346
347     print qq{
348
349 Every Makefile.PL is run by perl in a separate process. Likewise we
350 run \'make\' and \'make install\' in processes. If you have any
351 parameters \(e.g. PREFIX, LIB, UNINST or the like\) you want to pass
352 to the calls, please specify them here.
353
354 If you don\'t understand this question, just press ENTER.
355
356 };
357
358     $default = $CPAN::Config->{makepl_arg} || "";
359     $CPAN::Config->{makepl_arg} =
360         prompt("Parameters for the 'perl Makefile.PL' command?
361 Typical frequently used settings:
362
363     PREFIX=~/perl       non-root users (please see manual for more hints)
364
365 Your choice: ",$default);
366     $default = $CPAN::Config->{make_arg} || "";
367     $CPAN::Config->{make_arg} = prompt("Parameters for the 'make' command?
368 Typical frequently used setting:
369
370     -j3              dual processor system
371
372 Your choice: ",$default);
373
374     $default = $CPAN::Config->{make_install_arg} || $CPAN::Config->{make_arg} || "";
375     $CPAN::Config->{make_install_arg} =
376         prompt("Parameters for the 'make install' command?
377 Typical frequently used setting:
378
379     UNINST=1         to always uninstall potentially conflicting files
380
381 Your choice: ",$default);
382
383     #
384     # Alarm period
385     #
386
387     print qq{
388
389 Sometimes you may wish to leave the processes run by CPAN alone
390 without caring about them. As sometimes the Makefile.PL contains
391 question you\'re expected to answer, you can set a timer that will
392 kill a 'perl Makefile.PL' process after the specified time in seconds.
393
394 If you set this value to 0, these processes will wait forever. This is
395 the default and recommended setting.
396
397 };
398
399     $default = $CPAN::Config->{inactivity_timeout} || 0;
400     $CPAN::Config->{inactivity_timeout} =
401         prompt("Timeout for inactivity during Makefile.PL?",$default);
402
403     # Proxies
404
405     print qq{
406
407 If you\'re accessing the net via proxies, you can specify them in the
408 CPAN configuration or via environment variables. The variable in
409 the \$CPAN::Config takes precedence.
410
411 };
412
413     for (qw/ftp_proxy http_proxy no_proxy/) {
414         $default = $CPAN::Config->{$_} || $ENV{$_};
415         $CPAN::Config->{$_} = prompt("Your $_?",$default);
416     }
417
418     if ($CPAN::Config->{ftp_proxy} ||
419         $CPAN::Config->{http_proxy}) {
420         $default = $CPAN::Config->{proxy_user} || $CPAN::LWP::UserAgent::USER;
421         print qq{
422
423 If your proxy is an authenticating proxy, you can store your username
424 permanently. If you do not want that, just press RETURN. You will then
425 be asked for your username in every future session.
426
427 };
428         if ($CPAN::Config->{proxy_user} = prompt("Your proxy user id?",$default)) {
429             print qq{
430
431 Your password for the authenticating proxy can also be stored
432 permanently on disk. If this violates your security policy, just press
433 RETURN. You will then be asked for the password in every future
434 session.
435
436 };
437
438             if ($CPAN::META->has_inst("Term::ReadKey")) {
439                 Term::ReadKey::ReadMode("noecho");
440             } else {
441                 print qq{
442
443 Warning: Term::ReadKey seems not to be available, your password will
444 be echoed to the terminal!
445
446 };
447             }
448             $CPAN::Config->{proxy_pass} = prompt_no_strip("Your proxy password?");
449             if ($CPAN::META->has_inst("Term::ReadKey")) {
450                 Term::ReadKey::ReadMode("restore");
451             }
452             $CPAN::Frontend->myprint("\n\n");
453         }
454     }
455
456     #
457     # MIRRORED.BY
458     #
459
460     conf_sites() unless $fastread;
461
462     # We don't ask that now, it will be noticed in time, won't it?
463     $CPAN::Config->{'inhibit_startup_message'} = 0;
464     $CPAN::Config->{'getcwd'} = 'cwd';
465
466     print "\n\n";
467     CPAN::Config->commit($configpm);
468 }
469
470 sub conf_sites {
471   my $m = 'MIRRORED.BY';
472   my $mby = File::Spec->catfile($CPAN::Config->{keep_source_where},$m);
473   File::Path::mkpath(File::Basename::dirname($mby));
474   if (-f $mby && -f $m && -M $m < -M $mby) {
475     require File::Copy;
476     File::Copy::copy($m,$mby) or die "Could not update $mby: $!";
477   }
478   my $loopcount = 0;
479   local $^T = time;
480   my $overwrite_local = 0;
481   if ($mby && -f $mby && -M _ <= 60 && -s _ > 0) {
482       my $mtime = localtime((stat _)[9]);
483       my $prompt = qq{Found $mby as of $mtime
484
485 I\'d use that as a database of CPAN sites. If that is OK for you,
486 please answer 'y', but if you want me to get a new database now,
487 please answer 'n' to the following question.
488
489 Shall I use the local database in $mby?};
490       my $ans = prompt($prompt,"y");
491       $overwrite_local = 1 unless $ans =~ /^y/i;
492   }
493   while ($mby) {
494     if ($overwrite_local) {
495       print qq{Trying to overwrite $mby
496 };
497       $mby = CPAN::FTP->localize($m,$mby,3);
498       $overwrite_local = 0;
499     } elsif ( ! -f $mby ){
500       print qq{You have no $mby
501   I\'m trying to fetch one
502 };
503       $mby = CPAN::FTP->localize($m,$mby,3);
504     } elsif (-M $mby > 60 && $loopcount == 0) {
505       print qq{Your $mby is older than 60 days,
506   I\'m trying to fetch one
507 };
508       $mby = CPAN::FTP->localize($m,$mby,3);
509       $loopcount++;
510     } elsif (-s $mby == 0) {
511       print qq{You have an empty $mby,
512   I\'m trying to fetch one
513 };
514       $mby = CPAN::FTP->localize($m,$mby,3);
515     } else {
516       last;
517     }
518   }
519   read_mirrored_by($mby);
520   bring_your_own();
521 }
522
523 sub find_exe {
524     my($exe,$path) = @_;
525     my($dir);
526     #warn "in find_exe exe[$exe] path[@$path]";
527     for $dir (@$path) {
528         my $abs = File::Spec->catfile($dir,$exe);
529         if (($abs = MM->maybe_command($abs))) {
530             return $abs;
531         }
532     }
533 }
534
535 sub picklist {
536     my($items,$prompt,$default,$require_nonempty,$empty_warning)=@_;
537     $default ||= '';
538
539     my $pos = 0;
540
541     my @nums;
542     while (1) {
543
544         # display, at most, 15 items at a time
545         my $limit = $#{ $items } - $pos;
546         $limit = 15 if $limit > 15;
547
548         # show the next $limit items, get the new position
549         $pos = display_some($items, $limit, $pos);
550         $pos = 0 if $pos >= @$items;
551
552         my $num = prompt($prompt,$default);
553
554         @nums = split (' ', $num);
555         my $i = scalar @$items;
556         (warn "invalid items entered, try again\n"), next
557             if grep (/\D/ || $_ < 1 || $_ > $i, @nums);
558         if ($require_nonempty) {
559             (warn "$empty_warning\n");
560         }
561         print "\n";
562
563         # a blank line continues...
564         next unless @nums;
565         last;
566     }
567     for (@nums) { $_-- }
568     @{$items}[@nums];
569 }
570
571 sub display_some {
572         my ($items, $limit, $pos) = @_;
573         $pos ||= 0;
574
575         my @displayable = @$items[$pos .. ($pos + $limit)];
576     for my $item (@displayable) {
577                 printf "(%d) %s\n", ++$pos, $item;
578     }
579         printf("%d more items, hit SPACE RETURN to show them\n",
580                (@$items - $pos)
581               )
582             if $pos < @$items;
583         return $pos;
584 }
585
586 sub read_mirrored_by {
587     my $local = shift or return;
588     my(%all,$url,$expected_size,$default,$ans,$host,$dst,$country,$continent,@location);
589     my $fh = FileHandle->new;
590     $fh->open($local) or die "Couldn't open $local: $!";
591     local $/ = "\012";
592     while (<$fh>) {
593         ($host) = /^([\w\.\-]+)/ unless defined $host;
594         next unless defined $host;
595         next unless /\s+dst_(dst|location)/;
596         /location\s+=\s+\"([^\"]+)/ and @location = (split /\s*,\s*/, $1) and
597             ($continent, $country) = @location[-1,-2];
598         $continent =~ s/\s\(.*//;
599         $continent =~ s/\W+$//; # if Jarkko doesn't know latitude/longitude
600         /dst_dst\s+=\s+\"([^\"]+)/  and $dst = $1;
601         next unless $host && $dst && $continent && $country;
602         $all{$continent}{$country}{$dst} = CPAN::Mirrored::By->new($continent,$country,$dst);
603         undef $host;
604         $dst=$continent=$country="";
605     }
606     $fh->close;
607     $CPAN::Config->{urllist} ||= [];
608     my(@previous_urls);
609     if (@previous_urls = @{$CPAN::Config->{urllist}}) {
610         $CPAN::Config->{urllist} = [];
611     }
612
613     print qq{
614
615 Now we need to know where your favorite CPAN sites are located. Push
616 a few sites onto the array (just in case the first on the array won\'t
617 work). If you are mirroring CPAN to your local workstation, specify a
618 file: URL.
619
620 First, pick a nearby continent and country (you can pick several of
621 each, separated by spaces, or none if you just want to keep your
622 existing selections). Then, you will be presented with a list of URLs
623 of CPAN mirrors in the countries you selected, along with previously
624 selected URLs. Select some of those URLs, or just keep the old list.
625 Finally, you will be prompted for any extra URLs -- file:, ftp:, or
626 http: -- that host a CPAN mirror.
627
628 };
629
630     my (@cont, $cont, %cont, @countries, @urls, %seen);
631     my $no_previous_warn = 
632        "Sorry! since you don't have any existing picks, you must make a\n" .
633        "geographic selection.";
634     @cont = picklist([sort keys %all],
635                      "Select your continent (or several nearby continents)",
636                      '',
637                      ! @previous_urls,
638                      $no_previous_warn);
639
640
641     foreach $cont (@cont) {
642         my @c = sort keys %{$all{$cont}};
643         @cont{@c} = map ($cont, 0..$#c);
644         @c = map ("$_ ($cont)", @c) if @cont > 1;
645         push (@countries, @c);
646     }
647
648     if (@countries) {
649         @countries = picklist (\@countries,
650                                "Select your country (or several nearby countries)",
651                                '',
652                                ! @previous_urls,
653                                $no_previous_warn);
654         %seen = map (($_ => 1), @previous_urls);
655         # hmmm, should take list of defaults from CPAN::Config->{'urllist'}...
656         foreach $country (@countries) {
657             (my $bare_country = $country) =~ s/ \(.*\)//;
658             my @u = sort keys %{$all{$cont{$bare_country}}{$bare_country}};
659             @u = grep (! $seen{$_}, @u);
660             @u = map ("$_ ($bare_country)", @u)
661                if @countries > 1;
662             push (@urls, @u);
663         }
664     }
665     push (@urls, map ("$_ (previous pick)", @previous_urls));
666     my $prompt = "Select as many URLs as you like (by number),
667 put them on one line, separated by blanks, e.g. '1 4 5'";
668     if (@previous_urls) {
669        $default = join (' ', ((scalar @urls) - (scalar @previous_urls) + 1) ..
670                              (scalar @urls));
671        $prompt .= "\n(or just hit RETURN to keep your previous picks)";
672     }
673
674     @urls = picklist (\@urls, $prompt, $default);
675     foreach (@urls) { s/ \(.*\)//; }
676     push @{$CPAN::Config->{urllist}}, @urls;
677 }
678
679 sub bring_your_own {
680     my %seen = map (($_ => 1), @{$CPAN::Config->{urllist}});
681     my($ans,@urls);
682     do {
683         my $prompt = "Enter another URL or RETURN to quit:";
684         unless (%seen) {
685             $prompt = qq{CPAN.pm needs at least one URL where it can fetch CPAN files from.
686
687 Please enter your CPAN site:};
688         }
689         $ans = prompt ($prompt, "");
690
691         if ($ans) {
692             $ans =~ s|/?\z|/|; # has to end with one slash
693             $ans = "file:$ans" unless $ans =~ /:/; # without a scheme is a file:
694             if ($ans =~ /^\w+:\/./) {
695                 push @urls, $ans unless $seen{$ans}++;
696             } else {
697                 printf(qq{"%s" doesn\'t look like an URL at first sight.
698 I\'ll ignore it for now.
699 You can add it to your %s
700 later if you\'re sure it\'s right.\n},
701                        $ans,
702                        $INC{'CPAN/MyConfig.pm'} || $INC{'CPAN/Config.pm'} || "configuration file",
703                       );
704             }
705         }
706     } while $ans || !%seen;
707
708     push @{$CPAN::Config->{urllist}}, @urls;
709     # xxx delete or comment these out when you're happy that it works
710     print "New set of picks:\n";
711     map { print "  $_\n" } @{$CPAN::Config->{urllist}};
712 }
713
714
715 sub _strip_spaces {
716     $_[0] =~ s/^\s+//;  # no leading spaces
717     $_[0] =~ s/\s+\z//; # no trailing spaces
718 }
719
720
721 sub prompt ($;$) {
722     my $ans = _real_prompt(@_);
723
724     _strip_spaces($ans);
725
726     return $ans;
727 }
728
729
730 sub prompt_no_strip ($;$) {
731     return _real_prompt(@_);
732 }
733
734
735 *_real_prompt = \*ExtUtils::MakeMaker::prompt;
736
737
738 1;