CPAN
view release on metacpan or search on metacpan
lib/CPAN/FirstTime.pm view on Meta::CPAN
--install_base /home/xxx # different installation directory
Parameters for the 'perl Build.PL' command?
=item mbuild_arg
Parameters for the './Build' command? Setting might be:
--extra_linker_flags -L/usr/foo/lib # non-standard library location
Your choice:
=item mbuild_install_arg
Parameters for the './Build install' command? Typical frequently used
setting:
--uninst 1 # uninstall conflicting files
# (but do NOT use with local::lib or INSTALL_BASE)
Your choice:
=item mbuild_install_build_command
Do you want to use a different command for './Build install'? Sudo
users will probably prefer:
su root -c ./Build
or
sudo ./Build
or
/path1/to/sudo -u admin_account ./Build
or some such. Your choice:
=item pager
What is your favorite pager program?
=item prefer_installer
When you have Module::Build installed and a module comes with both a
Makefile.PL and a Build.PL, which shall have precedence?
The main two standard installer modules are the old and well
established ExtUtils::MakeMaker (for short: EUMM) which uses the
Makefile.PL. And the next generation installer Module::Build (MB)
which works with the Build.PL (and often comes with a Makefile.PL
too). If a module comes only with one of the two we will use that one
but if both are supplied then a decision must be made between EUMM and
MB. See also http://rt.cpan.org/Ticket/Display.html?id=29235 for a
discussion about the right default.
Or, as a third option you can choose RAND which will make a random
decision (something regular CPAN testers will enjoy).
In case you can choose between running a Makefile.PL or a Build.PL,
which installer would you prefer (EUMM or MB or RAND)?
=item prefs_dir
CPAN.pm can store customized build environments based on regular
expressions for distribution names. These are YAML files where the
default options for CPAN.pm and the environment can be overridden and
dialog sequences can be stored that can later be executed by an
Expect.pm object. The CPAN.pm distribution comes with some prefab YAML
files that cover sample distributions that can be used as blueprints
to store your own prefs. Please check out the distroprefs/ directory of
the CPAN.pm distribution to get a quick start into the prefs system.
Directory where to store default options/environment/dialogs for
building modules that need some customization?
=item prerequisites_policy
The CPAN module can detect when a module which you are trying to build
depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Choosing
'follow' also sets PERL_AUTOINSTALL and PERL_EXTUTILS_AUTOINSTALL for
"--defaultdeps" if not already set.
Please set your policy to one of the three values.
Policy on building prerequisites (follow, ask or ignore)?
=item pushy_https
Boolean. Defaults to true. If this option is true, the cpan shell will
use https://cpan.org/ to download stuff from the CPAN. It will fall
back to http://cpan.org/ if it can't handle https for some reason
(missing modules, missing programs). Whenever it falls back to the
http protocol, it will issue a warning.
If this option is true, the option C<urllist> will be ignored.
Consequently, if you want to work with local mirrors via your own
configured list of URLs, you will have to choose no below.
Do you want to turn the pushy_https behaviour on?
=item randomize_urllist
CPAN.pm can introduce some randomness when using hosts for download
that are configured in the urllist parameter. Enter a numeric value
between 0 and 1 to indicate how often you want to let CPAN.pm try a
random host from the urllist. A value of one specifies to always use a
random host as the first try. A value of zero means no randomness at
all. Anything in between specifies how often, on average, a random
host should be tried first.
Randomize parameter
=item recommends_policy
(Experimental feature!) Some CPAN modules recommend additional, optional dependencies. These should
generally be installed except in resource constrained environments. When this
policy is true, recommended modules will be included with required modules.
Include recommended modules?
=item scan_cache
By default, each time the CPAN module is started, cache scanning is
performed to keep the cache size in sync ('atstart'). Alternatively,
scanning and cleanup can happen when CPAN exits ('atexit'). To prevent
any cache cleanup, answer 'never'.
Perform cache scanning ('atstart', 'atexit' or 'never')?
lib/CPAN/FirstTime.pm view on Meta::CPAN
}
}
$matcher = "\\b(".join("|",@{$args{args}}).")\\b";
}
CPAN->debug("matcher[$matcher]") if $CPAN::DEBUG;
unless ($CPAN::VERSION) {
require CPAN::Nox;
}
require CPAN::HandleConfig;
CPAN::HandleConfig::require_myconfig_or_config();
$CPAN::Config ||= {};
local($/) = "\n";
local($\) = "";
local($|) = 1;
my($ans,$default); # why so half global?
#
#= Files, directories
#
local *_real_prompt;
if ( $args{autoconfig} ) {
$auto_config = 1;
} elsif ($matcher) {
$auto_config = 0;
} else {
my $_conf = prompt($prompts{auto_config}, "yes");
$auto_config = ($_conf and $_conf =~ /^y/i) ? 1 : 0;
}
CPAN->debug("auto_config[$auto_config]") if $CPAN::DEBUG;
if ( $auto_config ) {
local $^W = 0;
# prototype should match that of &MakeMaker::prompt
my $current_second = time;
my $current_second_count = 0;
my $i_am_mad = 0;
# silent prompting -- just quietly use default
*_real_prompt = sub { return $_[1] };
}
#
# bootstrap local::lib or sudo
#
unless ( $matcher
|| _can_write_to_libdirs() || _using_installbase() || _using_sudo()
) {
local $auto_config = 0; # We *must* ask, even under autoconfig
local *_real_prompt; # We *must* show prompt
my_prompt_loop(install_help => 'local::lib', $matcher,
'local::lib|sudo|manual');
}
$CPAN::Config->{install_help} ||= ''; # Temporary to suppress warnings
if (!$matcher or q{
build_dir
build_dir_reuse
cpan_home
keep_source_where
prefs_dir
} =~ /$matcher/) {
$CPAN::Frontend->myprint($prompts{config_intro}) unless $auto_config;
init_cpan_home($matcher);
my_dflt_prompt("keep_source_where",
File::Spec->catdir($CPAN::Config->{cpan_home},"sources"),
$matcher,
);
my_dflt_prompt("build_dir",
File::Spec->catdir($CPAN::Config->{cpan_home},"build"),
$matcher
);
my_yn_prompt(build_dir_reuse => 0, $matcher);
my_dflt_prompt("prefs_dir",
File::Spec->catdir($CPAN::Config->{cpan_home},"prefs"),
$matcher
);
}
#
#= Config: auto_commit
#
my_yn_prompt(auto_commit => 0, $matcher);
#
#= Cache size, Index expire
#
my_dflt_prompt(build_cache => 100, $matcher);
my_dflt_prompt(index_expire => 1, $matcher);
my_prompt_loop(scan_cache => 'atstart', $matcher, 'atstart|atexit|never');
my_yn_prompt(cleanup_after_install => 0, $matcher);
#
#= cache_metadata
#
my_yn_prompt(cache_metadata => 1, $matcher);
my_yn_prompt(use_sqlite => 0, $matcher);
#
#= Do we follow PREREQ_PM?
#
my_prompt_loop(prerequisites_policy => 'follow', $matcher,
'follow|ask|ignore');
my_prompt_loop(build_requires_install_policy => 'yes', $matcher,
'yes|no|ask/yes|ask/no');
my_yn_prompt(recommends_policy => 1, $matcher);
my_yn_prompt(suggests_policy => 0, $matcher);
#
#= Module::Signature
#
my_yn_prompt(check_sigs => 0, $matcher);
#
#= CPAN::Reporter
#
if (!$matcher or 'test_report' =~ /$matcher/) {
my_yn_prompt(test_report => 0, $matcher);
if (
$matcher &&
$CPAN::Config->{test_report} &&
$CPAN::META->has_inst("CPAN::Reporter") &&
CPAN::Reporter->can('configure')
) {
my $_conf = prompt("Would you like me configure CPAN::Reporter now?", "yes");
if ($_conf =~ /^y/i) {
$CPAN::Frontend->myprint("\nProceeding to configure CPAN::Reporter.\n");
CPAN::Reporter::configure();
$CPAN::Frontend->myprint("\nReturning to CPAN configuration.\n");
}
}
lib/CPAN/FirstTime.pm view on Meta::CPAN
if ("randomize_urllist" =~ $matcher) {
my_dflt_prompt(randomize_urllist => 0, $matcher);
}
if ("ftpstats_size" =~ $matcher) {
my_dflt_prompt(ftpstats_size => 99, $matcher);
}
if ("ftpstats_period" =~ $matcher) {
my_dflt_prompt(ftpstats_period => 14, $matcher);
}
}
$CPAN::Config->{urllist} ||= [];
if ($auto_config) {
if(@{ $CPAN::Config->{urllist} }) {
$CPAN::Frontend->myprint(
"Your 'urllist' is already configured. Type 'o conf init urllist' to change it.\n"
);
}
else {
# Hint: as of 2021-11: to get http, use http://www.cpan.org/
$CPAN::Config->{urllist} = [ 'https://cpan.org/' ];
$CPAN::Frontend->myprint(
"We initialized your 'urllist' to @{$CPAN::Config->{urllist}}. Type 'o conf init urllist' to change it.\n"
);
}
}
elsif (!$matcher || "urllist" =~ $matcher) {
_do_pick_mirrors();
}
if ($auto_config) {
$CPAN::Frontend->myprint(
"\nAutoconfiguration complete.\n"
);
$auto_config = 0; # reset
}
# bootstrap local::lib now if requested
if ( $CPAN::Config->{install_help} eq 'local::lib' ) {
if ( ! @{ $CPAN::Config->{urllist} } ) {
$CPAN::Frontend->myprint(
"\nALERT: Skipping local::lib bootstrap because 'urllist' is not configured.\n"
);
}
elsif (! $CPAN::Config->{make} ) {
$CPAN::Frontend->mywarn(
"\nALERT: Skipping local::lib bootstrap because 'make' is not configured.\n"
);
_beg_for_make(); # repetitive, but we don't want users to miss it
}
else {
$CPAN::Frontend->myprint("\nAttempting to bootstrap local::lib...\n");
$CPAN::Frontend->myprint("\nWriting $configpm for bootstrap...\n");
delete $CPAN::Config->{install_help}; # temporary only
CPAN::HandleConfig->commit;
my($dist, $locallib);
$locallib = CPAN::Shell->expand('Module', 'local::lib');
if ( $locallib and $dist = $locallib->distribution ) {
# this is a hack to force bootstrapping
$dist->{prefs}{pl}{commandline} = "$^X Makefile.PL --bootstrap";
# Set @INC for this process so we find things as they bootstrap
require lib;
lib->import(_local_lib_inc_path());
eval { $dist->install };
}
if ( ! $dist || (my $err = $@) ) {
$err ||= 'Could not locate local::lib in the CPAN index';
$CPAN::Frontend->mywarn("Error bootstrapping local::lib: $@\n");
$CPAN::Frontend->myprint("From the CPAN Shell, you might try 'look local::lib' and \n"
. "run 'perl Makefile --bootstrap' and see if that is successful. Then\n"
. "restart your CPAN client\n"
);
}
else {
_local_lib_config();
}
}
}
# install_help is temporary for configuration and not saved
delete $CPAN::Config->{install_help};
$CPAN::Frontend->myprint("\n");
if ($matcher && !$CPAN::Config->{auto_commit}) {
$CPAN::Frontend->myprint("Please remember to call 'o conf commit' to ".
"make the config permanent!\n");
} else {
CPAN::HandleConfig->commit;
}
if (! $matcher) {
$CPAN::Frontend->myprint(
"\nYou can re-run configuration any time with 'o conf init' in the CPAN shell\n"
);
}
}
sub _local_lib_config {
# Set environment stuff for this process
require local::lib;
# Tell user about environment vars to set
$CPAN::Frontend->myprint($prompts{local_lib_installed});
local $ENV{SHELL} = $CPAN::Config->{shell} || $ENV{SHELL};
my $shellvars = local::lib->environment_vars_string_for(_local_lib_path());
$CPAN::Frontend->myprint($shellvars);
# Set %ENV after getting string above
my %env = local::lib->build_environment_vars_for(_local_lib_path(), 1);
while ( my ($k, $v) = each %env ) {
$ENV{$k} = $v;
}
# Offer to mangle the shell config
my $munged_rc;
if ( my $rc = _find_shell_config() ) {
local $auto_config = 0; # We *must* ask, even under autoconfig
local *_real_prompt; # We *must* show prompt
my $_conf = prompt(
( run in 2.710 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )