📄 setup.pm
字号:
What email address should we send as our anonymous password whenfetching modules from CPAN servers? Some servers will NOT allow you toconnect without a valid email address, or at least something that lookslike one.Also, if you choose to report test results at some point, a valid emailis required for the 'from' field, so choose wisely. "); my $other = 'Something else'; my @choices = (DEFAULT_EMAIL, $Config{cf_email}, $other); my $current = $conf->get_conf('email'); ### if your current address is not in the list, add it to the choices unless (grep { $_ eq $current } @choices) { unshift @choices, $current; } my $email = $term->get_reply( prompt => loc('Which email address shall I use?'), default => $current || $choices[0], choices => \@choices, ); if( $email eq $other ) { EMAIL: { $email = $term->get_reply( prompt => loc('Email address: '), ); unless( $self->_valid_email($email) ) { print loc("You did not enter a valid email address, please try again! ") if length $email; redo EMAIL; } } } print loc("Your 'email' is now: %1 ", $email); $conf->set_conf( email => $email ); return 1;}### commandline programssub _setup_program { my $self = shift; my $term = $self->term; my $conf = $self->configure_object; print loc("CPANPLUS can use command line utilities to do certaintasks, rather than use perl modules.If you wish to use a certain command utility, just enterthe full path (or accept the default). If you do not wishto use it, enter a single space.Note that the paths you provide should not contain spaces, which isneeded to make a distinction between program name and options to thatprogram. For Win32 machines, you can use the short name for a path,like '%1'.", 'c:\Progra~1\prog.exe' ); for my $prog ( sort $conf->options( type => 'program') ) { PROGRAM: { print "\n", loc("Where can I find your '%1' utility? ". "(Enter a single space to disable)", $prog ), "\n"; my $loc = $term->get_reply( prompt => "Path to your '$prog'", default => $conf->get_program( $prog ), ); ### empty line clears it my $cmd = $loc =~ /^\s*$/ ? undef : $loc; my ($bin) = $cmd =~ /^(\S+)/; ### did you provide a valid program ? if( $bin and not can_run( $bin ) ) { print "\n"; print loc("Can not find the binary '%1' in your path!", $bin); redo PROGRAM; } ### make is special -- we /need/ it! if( $prog eq 'make' and not $bin ) { print loc( "==> Without your '%1' utility, I can not function! <==", 'make' ); print loc("Please provide one!"); ### show win32 where to download if ( $^O eq 'MSWin32' ) { print loc("You can get '%1' from:", NMAKE); print "\t". NMAKE_URL ."\n"; } print "\n"; redo PROGRAM; } $conf->set_program( $prog => $cmd ); print $cmd ? loc( "Your '%1' utility has been set to '%2'.", $prog, $cmd ) : loc( "Your '%1' has been disabled.", $prog ); print "\n"; } } return 1;} sub _setup_installer { my $self = shift; my $term = $self->term; my $conf = $self->configure_object; my $none = 'None'; { print loc("CPANPLUS uses binary programs as well as Perl modules to accomplishvarious tasks. Normally, CPANPLUS will prefer the use of Perl modulesover binary programs.You can change this setting by making CPANPLUS prefer the use ofcertain binary programs if they are available. "); ### default to using binaries if we don't have compress::zlib only ### -- it'll get very noisy otherwise my $type = 'prefer_bin'; my $yn = $term->ask_yn( prompt => loc("Should I prefer the use of binary programs?"), default => $conf->get_conf( $type ), ); print $yn ? loc("Ok, I will prefer to use binary programs if possible.") : loc("Ok, I will prefer to use Perl modules if possible."); print "\n\n"; $conf->set_conf( $type => $yn ); } { print loc("Makefile.PL is run by perl in a separate process, and accepts variousflags that controls the module's installation. For instance, if youwould like to install modules to your private user directory, set'makemakerflags' to:LIB=~/perl/lib INSTALLMAN1DIR=~/perl/man/man1 INSTALLMAN3DIR=~/perl/man/man3and be sure that you do NOT set UNINST=1 in 'makeflags' below.Enter a name=value list separated by whitespace, but quote any embeddedspaces that you want to preserve. (Enter a space to clear any existingsettings.)If you don't understand this question, just press ENTER. "); my $type = 'makemakerflags'; my $flags = $term->get_reply( prompt => 'Makefile.PL flags?', default => $conf->get_conf($type), ); $flags = '' if $flags eq $none || $flags !~ /\S/; print "\n", loc("Your '%1' have been set to:", 'Makefile.PL flags'), "\n ", ( $flags ? $flags : loc('*nothing entered*')), "\n\n"; $conf->set_conf( $type => $flags ); } { print loc("Like Makefile.PL, we run 'make' and 'make install' as separate processes.If you have any parameters (e.g. '-j3' in dual processor systems) you wantto pass to the calls, please specify them here.In particular, 'UNINST=1' is recommended for root users, unless you havefine-tuned ideas of where modules should be installed in the \@INC path.Enter a name=value list separated by whitespace, but quote any embeddedspaces that you want to preserve. (Enter a space to clear any existingsettings.)Again, if you don't understand this question, just press ENTER. "); my $type = 'makeflags'; my $flags = $term->get_reply( prompt => 'make flags?', default => $conf->get_conf($type), ); $flags = '' if $flags eq $none || $flags !~ /\S/; print "\n", loc("Your '%1' have been set to:", $type), "\n ", ( $flags ? $flags : loc('*nothing entered*')), "\n\n"; $conf->set_conf( $type => $flags ); } { print loc("An alternative to ExtUtils::MakeMaker and Makefile.PL there's a modulecalled Module::Build which uses a Build.PL.If you would like to specify any flags to pass when executing theBuild.PL (and Build) script, please enter them below.For instance, if you would like to install modules to your privateuser directory, you could enter: install_base=/my/private/pathOr to uninstall old copies of modules before updating, you mightwant to enter: uninst=1Again, if you don't understand this question, just press ENTER. "); my $type = 'buildflags'; my $flags = $term->get_reply( prompt => 'Build.PL and Build flags?', default => $conf->get_conf($type), ); $flags = '' if $flags eq $none || $flags !~ /\S/; print "\n", loc("Your '%1' have been set to:", 'Build.PL and Build flags'), "\n ", ( $flags ? $flags : loc('*nothing entered*')), "\n\n"; $conf->set_conf( $type => $flags ); } ### use EU::MM or module::build? ### { print loc("Some modules provide both a Build.PL (Module::Build) and a Makefile.PL(ExtUtils::MakeMaker). By default, CPANPLUS prefers Makefile.PL.Module::Build support is not bundled standard with CPANPLUS, but requires you to install 'CPANPLUS::Dist::Build' from CPAN.Although Module::Build is a pure perl solution, which means you willnot need a 'make' binary, it does have some limitations. The mostimportant is that CPANPLUS is unable to uninstall any modules installedby Module::Build.Again, if you don't understand this question, just press ENTER. "); my $type = 'prefer_makefile'; my $yn = $term->ask_yn( prompt => loc("Prefer Makefile.PL over Build.PL?"), default => $conf->get_conf($type), ); $conf->set_conf( $type => $yn ); } { print loc('If you like, CPANPLUS can add extra directories to your @INC list duringstartup. These will just be used by CPANPLUS and will not change yourexternal environment or perl interpreter. Enter a space separated list ofpathnames to be added to your @INC, quoting any with embedded whitespace.(To clear the current value enter a single space.) '); my $type = 'lib'; my $flags = $term->get_reply( prompt => loc('Additional @INC directories to add?'), default => (join " ", @{$conf->get_conf($type) || []} ), ); my $lib; unless( $flags =~ /\S/ ) { $lib = []; } else { (@$lib) = $flags =~ m/\s*("[^"]+"|'[^']+'|[^\s]+)/g; } print "\n", loc("Your additional libs are now:"), "\n"; print scalar @$lib ? map { " $_\n" } @$lib : " ", loc("*nothing entered*"), "\n"; print "\n\n"; $conf->set_conf( $type => $lib ); } return 1;} sub _setup_conf { my $self = shift; my $term = $self->term; my $conf = $self->configure_object; my $none = 'None'; { ############ ## noisy? ## ############ print loc("In normal operation I can just give you basic information about what Iam doing, or I can be more verbose and give you every little detail. "); my $type = 'verbose'; my $yn = $term->ask_yn( prompt => loc("Should I be verbose?"), default => $conf->get_conf( $type ), ); print "\n"; print $yn ? loc("You asked for it!") : loc("I'll try to be quiet"); $conf->set_conf( $type => $yn ); } { ####################### ## flush you animal! ## ####################### print loc("In the interest of speed, we keep track of what modules were installedsuccessfully and which failed in the current session. We can flush thisdata automatically, or you can explicitly issue a 'flush' when you wantto purge it. "); my $type = 'flush'; my $yn = $term->ask_yn( prompt => loc("Flush automatically?"), default => $conf->get_conf( $type ), ); print "\n"; print $yn ? loc("I'll flush after every full module install.") : loc("I won't flush until you tell me to."); $conf->set_conf( $type => $yn ); } { ##################### ## force installs? ## ##################### print loc("Usually, when a test fails, I won't install the module, but if youprefer, I can force the install anyway. "); my $type = 'force'; my $yn = $term->ask_yn( prompt => loc("Force installs?"), default => $conf->get_conf( $type ), ); print "\n"; print $yn ? loc("I will force installs.") : loc("I won't force installs."); $conf->set_conf( $type => $yn ); } { ################### ## about prereqs ##
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -