blib/lib/CPAN/FirstTime.pm

filter: Statementstmt 64.7% 455 / 703 Branchbran 40.5% 168 / 414 Conditioncond 41.3% 113 / 273 MC/DCmcdc 14.4% 22 / 152 Subroutinesub 78.5% 33 / 42 Podpod 0.0% 0 / 15 totaltotal 49.4% 791 / 1599 CC 313 SCAR 65.5
CC
313
Cov
53%
init
1769.9
conf_sites
160.6
init_cpan_home
69.5
CRAP 702.3
« blib/lib/CPAN/Shell.pm ↑ Summary blib/lib/CPAN/Tarzip.pm »
1 # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
2 # vim: ts=4 sts=4 sw=4:
3 package CPAN::FirstTime;
4 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 ▶use ExtUtils::MakeMaker ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 7 ▶use FileHandle ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 7 ▶use File::Basename ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use File::Path ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 7 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 7 ▶use CPAN::Mirrors ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 7 ▶use CPAN::Version ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 7 ▶use vars qw($VERSION $auto_config);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 7 $VERSION = "5.5321";
15  
16 =head1 NAME
17  
18 CPAN::FirstTime - Utility for CPAN::Config file Initialization
19  
20 =head1 SYNOPSIS
21  
22 CPAN::FirstTime::init()
23  
24 =head1 DESCRIPTION
25  
26 The init routine asks a few questions and writes a CPAN/Config.pm or
27 CPAN/MyConfig.pm file (depending on what it is currently using).
28  
29 In the following all questions and explanations regarding config
30 variables are collected.
31  
32 =cut
33  
34 # down until the next =back the manpage must be parsed by the program
35 # because the text is used in the init dialogues.
36  
37 7 my @podpara = split /\n\n/, <<'=back';
38  
39 =over 2
40  
41 =item allow_installing_module_downgrades
42  
43 The CPAN shell can watch the C<blib/> directories that are built up
44 before running C<make test> to determine whether the current
45 distribution will end up with modules being overwritten with decreasing module version numbers. It
46 can then let the build of this distro fail when it discovers a
47 downgrade.
48  
49 Do you want to allow installing distros with decreasing module
50 versions compared to what you have installed (yes, no, ask/yes,
51 ask/no)?
52  
53 =item allow_installing_outdated_dists
54  
55 The CPAN shell can watch the C<blib/> directories that are built up
56 before running C<make test> to determine whether the current
57 distribution contains modules that are indexed with a distro with a
58 higher distro-version number than the current one. It can
59 then let the build of this distro fail when it would not represent the
60 most up-to-date version of the distro.
61  
62 Note: choosing anything but 'yes' for this option will need
63 CPAN::DistnameInfo being installed for taking effect.
64  
65 Do you want to allow installing distros that are not indexed as the
66 highest distro-version for all contained modules (yes, no, ask/yes,
67 ask/no)?
68  
69 =item auto_commit
70  
71 Normally CPAN.pm keeps config variables in memory and changes need to
72 be saved in a separate 'o conf commit' command to make them permanent
73 between sessions. If you set the 'auto_commit' option to true, changes
74 to a config variable are always automatically committed to disk.
75  
76 Always commit changes to config variables to disk?
77  
78 =item build_cache
79  
80 CPAN.pm can limit the size of the disk area for keeping the build
81 directories with all the intermediate files.
82  
83 Cache size for build directory (in MB)?
84  
85 =item build_dir
86  
87 Directory where the build process takes place?
88  
89 =item build_dir_reuse
90  
91 Until version 1.88 CPAN.pm never trusted the contents of the build_dir
92 directory between sessions. Since 1.88_58 CPAN.pm has a YAML-based
93 mechanism that makes it possible to share the contents of the
94 build_dir/ directory between different sessions with the same version
95 of perl. People who prefer to test things several days before
96 installing will like this feature because it saves a lot of time.
97  
98 If you say yes to the following question, CPAN will try to store
99 enough information about the build process so that it can pick up in
100 future sessions at the same state of affairs as it left a previous
101 session.
102  
103 Store and re-use state information about distributions between
104 CPAN.pm sessions?
105  
106 =item build_requires_install_policy
107  
108 When a module declares another one as a 'build_requires' prerequisite
109 this means that the other module is only needed for building or
110 testing the module but need not be installed permanently. In this case
111 you may wish to install that other module nonetheless or just keep it
112 in the 'build_dir' directory to have it available only temporarily.
113 Installing saves time on future installations but makes the perl
114 installation bigger.
115  
116 You can choose if you want to always install (yes), never install (no)
117 or be always asked. In the latter case you can set the default answer
118 for the question to yes (ask/yes) or no (ask/no).
119  
120 Policy on installing 'build_requires' modules (yes, no, ask/yes,
121 ask/no)?
122  
123 =item cache_metadata
124  
125 To considerably speed up the initial CPAN shell startup, it is
126 possible to use Storable to create a cache of metadata. If Storable is
127 not available, the normal index mechanism will be used.
128  
129 Note: this mechanism is not used when use_sqlite is on and SQLite is
130 running.
131  
132 Cache metadata (yes/no)?
133  
134 =item check_sigs
135  
136 CPAN packages can be digitally signed by authors and thus verified
137 with the security provided by strong cryptography. The exact mechanism
138 is defined in the Module::Signature module. While this is generally
139 considered a good thing, it is not always convenient to the end user
140 to install modules that are signed incorrectly or where the key of the
141 author is not available or where some prerequisite for
142 Module::Signature has a bug and so on.
143  
144 With the check_sigs parameter you can turn signature checking on and
145 off. The default is off for now because the whole tool chain for the
146 functionality is not yet considered mature by some. The author of
147 CPAN.pm would recommend setting it to true most of the time and
148 turning it off only if it turns out to be annoying.
149  
150 Note that if you do not have Module::Signature installed, no signature
151 checks will be performed at all.
152  
153 Always try to check and verify signatures if a SIGNATURE file is in
154 the package and Module::Signature is installed (yes/no)?
155  
156 =item cleanup_after_install
157  
158 Users who install modules and do not intend to look back, can free
159 occupied disk space quickly by letting CPAN.pm cleanup each build
160 directory immediately after a successful install.
161  
162 Remove build directory after a successful install? (yes/no)?
163  
164 =item colorize_output
165  
166 When you have Term::ANSIColor installed, you can turn on colorized
167 output to have some visual differences between normal CPAN.pm output,
168 warnings, debugging output, and the output of the modules being
169 installed. Set your favorite colors after some experimenting with the
170 Term::ANSIColor module.
171  
172 Please note that on Windows platforms colorized output also requires
173 the Win32::Console::ANSI module.
174  
175 Do you want to turn on colored output?
176  
177 =item colorize_print
178  
179 Color for normal output?
180  
181 =item colorize_warn
182  
183 Color for warnings?
184  
185 =item colorize_debug
186  
187 Color for debugging messages?
188  
189 =item commandnumber_in_prompt
190  
191 The prompt of the cpan shell can contain the current command number
192 for easier tracking of the session or be a plain string.
193  
194 Do you want the command number in the prompt (yes/no)?
195  
196 =item connect_to_internet_ok
197  
198 If you have never defined your own C<urllist> in your configuration
199 then C<CPAN.pm> will be hesitant to use the built in default sites for
200 downloading. It will ask you once per session if a connection to the
201 internet is OK and only if you say yes, it will try to connect. But to
202 avoid this question, you can choose your favorite download sites once
203 and get away with it. Or, if you have no favorite download sites
204 answer yes to the following question.
205  
206 If no urllist has been chosen yet, would you prefer CPAN.pm to connect
207 to the built-in default sites without asking? (yes/no)?
208  
209 =item ftp_passive
210  
211 Shall we always set the FTP_PASSIVE environment variable when dealing
212 with ftp download (yes/no)?
213  
214 =item ftpstats_period
215  
216 Statistics about downloads are truncated by size and period
217 simultaneously.
218  
219 How many days shall we keep statistics about downloads?
220  
221 =item ftpstats_size
222  
223 Statistics about downloads are truncated by size and period
224 simultaneously. Setting this to zero or negative disables download
225 statistics.
226  
227 How many items shall we keep in the statistics about downloads?
228  
229 =item getcwd
230  
231 CPAN.pm changes the current working directory often and needs to
232 determine its own current working directory. Per default it uses
233 Cwd::cwd but if this doesn't work on your system for some reason,
234 alternatives can be configured according to the following table:
235  
236 cwd Cwd::cwd
237 getcwd Cwd::getcwd
238 fastcwd Cwd::fastcwd
239 getdcwd Cwd::getdcwd
240 backtickcwd external command cwd
241  
242 Preferred method for determining the current working directory?
243  
244 =item halt_on_failure
245  
246 Normally, CPAN.pm continues processing the full list of targets and
247 dependencies, even if one of them fails. However, you can specify
248 that CPAN should halt after the first failure. (Note that optional
249 recommended or suggested modules that fail will not cause a halt.)
250  
251 Do you want to halt on failure (yes/no)?
252  
253 =item histfile
254  
255 If you have one of the readline packages (Term::ReadLine::Perl,
256 Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
257 shell will have history support. The next two questions deal with the
258 filename of the history file and with its size. If you do not want to
259 set this variable, please hit SPACE ENTER to the following question.
260  
261 File to save your history?
262  
263 =item histsize
264  
265 Number of lines to save?
266  
267 =item inactivity_timeout
268  
269 Sometimes you may wish to leave the processes run by CPAN alone
270 without caring about them. Because the Makefile.PL or the Build.PL
271 sometimes contains question you're expected to answer, you can set a
272 timer that will kill a 'perl Makefile.PL' process after the specified
273 time in seconds.
274  
275 If you set this value to 0, these processes will wait forever. This is
276 the default and recommended setting.
277  
278 Timeout for inactivity during {Makefile,Build}.PL?
279  
280 =item index_expire
281  
282 The CPAN indexes are usually rebuilt once or twice per hour, but the
283 typical CPAN mirror mirrors only once or twice per day. Depending on
284 the quality of your mirror and your desire to be on the bleeding edge,
285 you may want to set the following value to more or less than one day
286 (which is the default). It determines after how many days CPAN.pm
287 downloads new indexes.
288  
289 Let the index expire after how many days?
290  
291 =item inhibit_startup_message
292  
293 When the CPAN shell is started it normally displays a greeting message
294 that contains the running version and the status of readline support.
295  
296 Do you want to turn this message off?
297  
298 =item keep_source_where
299  
300 Unless you are accessing the CPAN on your filesystem via a file: URL,
301 CPAN.pm needs to keep the source files it downloads somewhere. Please
302 supply a directory where the downloaded files are to be kept.
303  
304 Download target directory?
305  
306 =item load_module_verbosity
307  
308 When CPAN.pm loads a module it needs for some optional feature, it
309 usually reports about module name and version. Choose 'v' to get this
310 message, 'none' to suppress it.
311  
312 Verbosity level for loading modules (none or v)?
313  
314 =item makepl_arg
315  
316 Every Makefile.PL is run by perl in a separate process. Likewise we
317 run 'make' and 'make install' in separate processes. If you have
318 any parameters (e.g. PREFIX, UNINST or the like) you want to
319 pass to the calls, please specify them here.
320  
321 If you don't understand this question, just press ENTER.
322  
323 Typical frequently used settings:
324  
325 PREFIX=~/perl # non-root users (please see manual for more hints)
326  
327 Parameters for the 'perl Makefile.PL' command?
328  
329 =item make_arg
330  
331 Parameters for the 'make' command? Typical frequently used setting:
332  
333 -j3 # dual processor system (on GNU make)
334  
335 Your choice:
336  
337 =item make_install_arg
338  
339 Parameters for the 'make install' command?
340 Typical frequently used setting:
341  
342 UNINST=1 # to always uninstall potentially conflicting files
343 # (but do NOT use with local::lib or INSTALL_BASE)
344  
345 Your choice:
346  
347 =item make_install_make_command
348  
349 Do you want to use a different make command for 'make install'?
350 Cautious people will probably prefer:
351  
352 su root -c make
353 or
354 sudo make
355 or
356 /path1/to/sudo -u admin_account /path2/to/make
357  
358 or some such. Your choice:
359  
360 =item mbuildpl_arg
361  
362 A Build.PL is run by perl in a separate process. Likewise we run
363 './Build' and './Build install' in separate processes. If you have any
364 parameters you want to pass to the calls, please specify them here.
365  
366 Typical frequently used settings:
367  
368 --install_base /home/xxx # different installation directory
369  
370 Parameters for the 'perl Build.PL' command?
371  
372 =item mbuild_arg
373  
374 Parameters for the './Build' command? Setting might be:
375  
376 --extra_linker_flags -L/usr/foo/lib # non-standard library location
377  
378 Your choice:
379  
380 =item mbuild_install_arg
381  
382 Parameters for the './Build install' command? Typical frequently used
383 setting:
384  
385 --uninst 1 # uninstall conflicting files
386 # (but do NOT use with local::lib or INSTALL_BASE)
387  
388 Your choice:
389  
390 =item mbuild_install_build_command
391  
392 Do you want to use a different command for './Build install'? Sudo
393 users will probably prefer:
394  
395 su root -c ./Build
396 or
397 sudo ./Build
398 or
399 /path1/to/sudo -u admin_account ./Build
400  
401 or some such. Your choice:
402  
403 =item pager
404  
405 What is your favorite pager program?
406  
407 =item prefer_installer
408  
409 When you have Module::Build installed and a module comes with both a
410 Makefile.PL and a Build.PL, which shall have precedence?
411  
412 The main two standard installer modules are the old and well
413 established ExtUtils::MakeMaker (for short: EUMM) which uses the
414 Makefile.PL. And the next generation installer Module::Build (MB)
415 which works with the Build.PL (and often comes with a Makefile.PL
416 too). If a module comes only with one of the two we will use that one
417 but if both are supplied then a decision must be made between EUMM and
418 MB. See also http://rt.cpan.org/Ticket/Display.html?id=29235 for a
419 discussion about the right default.
420  
421 Or, as a third option you can choose RAND which will make a random
422 decision (something regular CPAN testers will enjoy).
423  
424 In case you can choose between running a Makefile.PL or a Build.PL,
425 which installer would you prefer (EUMM or MB or RAND)?
426  
427 =item prefs_dir
428  
429 CPAN.pm can store customized build environments based on regular
430 expressions for distribution names. These are YAML files where the
431 default options for CPAN.pm and the environment can be overridden and
432 dialog sequences can be stored that can later be executed by an
433 Expect.pm object. The CPAN.pm distribution comes with some prefab YAML
434 files that cover sample distributions that can be used as blueprints
435 to store your own prefs. Please check out the distroprefs/ directory of
436 the CPAN.pm distribution to get a quick start into the prefs system.
437  
438 Directory where to store default options/environment/dialogs for
439 building modules that need some customization?
440  
441 =item prerequisites_policy
442  
443 The CPAN module can detect when a module which you are trying to build
444 depends on prerequisites. If this happens, it can build the
445 prerequisites for you automatically ('follow'), ask you for
446 confirmation ('ask'), or just ignore them ('ignore'). Choosing
447 'follow' also sets PERL_AUTOINSTALL and PERL_EXTUTILS_AUTOINSTALL for
448 "--defaultdeps" if not already set.
449  
450 Please set your policy to one of the three values.
451  
452 Policy on building prerequisites (follow, ask or ignore)?
453  
454 =item pushy_https
455  
456 Boolean. Defaults to true. If this option is true, the cpan shell will
457 use https://www.cpan.org/ to download stuff from the CPAN. It will fall
458 back to http://www.cpan.org/ if it can't handle https for some reason
459 (missing modules, missing programs). Whenever it falls back to the
460 http protocol, it will issue a warning.
461  
462 If this option is true, the option C<urllist> will be ignored.
463 Consequently, if you want to work with local mirrors via your own
464 configured list of URLs, you will have to choose no below.
465  
466 Do you want to turn the pushy_https behaviour on?
467  
468 =item randomize_urllist
469  
470 CPAN.pm can introduce some randomness when using hosts for download
471 that are configured in the urllist parameter. Enter a numeric value
472 between 0 and 1 to indicate how often you want to let CPAN.pm try a
473 random host from the urllist. A value of one specifies to always use a
474 random host as the first try. A value of zero means no randomness at
475 all. Anything in between specifies how often, on average, a random
476 host should be tried first.
477  
478 Randomize parameter
479  
480 =item recommends_policy
481  
482 (Experimental feature!) Some CPAN modules recommend additional, optional dependencies. These should
483 generally be installed except in resource constrained environments. When this
484 policy is true, recommended modules will be included with required modules.
485  
486 Include recommended modules?
487  
488 =item scan_cache
489  
490 By default, each time the CPAN module is started, cache scanning is
491 performed to keep the cache size in sync ('atstart'). Alternatively,
492 scanning and cleanup can happen when CPAN exits ('atexit'). To prevent
493 any cache cleanup, answer 'never'.
494  
495 Perform cache scanning ('atstart', 'atexit' or 'never')?
496  
497 =item shell
498  
499 What is your favorite shell?
500  
501 =item show_unparsable_versions
502  
503 During the 'r' command CPAN.pm finds modules without version number.
504 When the command finishes, it prints a report about this. If you
505 want this report to be very verbose, say yes to the following
506 variable.
507  
508 Show all individual modules that have no $VERSION?
509  
510 =item show_upload_date
511  
512 The 'd' and the 'm' command normally only show you information they
513 have in their in-memory database and thus will never connect to the
514 internet. If you set the 'show_upload_date' variable to true, 'm' and
515 'd' will additionally show you the upload date of the module or
516 distribution. Per default this feature is off because it may require a
517 net connection to get at the upload date.
518  
519 Always try to show upload date with 'd' and 'm' command (yes/no)?
520  
521 =item show_zero_versions
522  
523 During the 'r' command CPAN.pm finds modules with a version number of
524 zero. When the command finishes, it prints a report about this. If you
525 want this report to be very verbose, say yes to the following
526 variable.
527  
528 Show all individual modules that have a $VERSION of zero?
529  
530 =item suggests_policy
531  
532 (Experimental feature!) Some CPAN modules suggest additional, optional dependencies. These 'suggest'
533 dependencies provide enhanced operation. When this policy is true, suggested
534 modules will be included with required modules.
535  
536 Include suggested modules?
537  
538 =item tar_verbosity
539  
540 When CPAN.pm uses the tar command, which switch for the verbosity
541 shall be used? Choose 'none' for quiet operation, 'v' for file
542 name listing, 'vv' for full listing.
543  
544 Tar command verbosity level (none or v or vv)?
545  
546 =item term_is_latin
547  
548 The next option deals with the charset (a.k.a. character set) your
549 terminal supports. In general, CPAN is English speaking territory, so
550 the charset does not matter much but some CPAN have names that are
551 outside the ASCII range. If your terminal supports UTF-8, you should
552 say no to the next question. If it expects ISO-8859-1 (also known as
553 LATIN1) then you should say yes. If it supports neither, your answer
554 does not matter because you will not be able to read the names of some
555 authors anyway. If you answer no, names will be output in UTF-8.
556  
557 Your terminal expects ISO-8859-1 (yes/no)?
558  
559 =item term_ornaments
560  
561 When using Term::ReadLine, you can turn ornaments on so that your
562 input stands out against the output from CPAN.pm.
563  
564 Do you want to turn ornaments on?
565  
566 =item test_report
567  
568 The goal of the CPAN Testers project (http://testers.cpan.org/) is to
569 test as many CPAN packages as possible on as many platforms as
570 possible. This provides valuable feedback to module authors and
571 potential users to identify bugs or platform compatibility issues and
572 improves the overall quality and value of CPAN.
573  
574 One way you can contribute is to send test results for each module
575 that you install. If you install the CPAN::Reporter module, you have
576 the option to automatically generate and deliver test reports to CPAN
577 Testers whenever you run tests on a CPAN package.
578  
579 See the CPAN::Reporter documentation for additional details and
580 configuration settings. If your firewall blocks outgoing traffic,
581 you may need to configure CPAN::Reporter before sending reports.
582  
583 Generate test reports if CPAN::Reporter is installed (yes/no)?
584  
585 =item perl5lib_verbosity
586  
587 When CPAN.pm extends @INC via PERL5LIB, it prints a list of
588 directories added (or a summary of how many directories are
589 added). Choose 'v' to get this message, 'none' to suppress it.
590  
591 Verbosity level for PERL5LIB changes (none or v)?
592  
593 =item prefer_external_tar
594  
595 Per default all untar operations are done with the perl module
596 Archive::Tar; by setting this variable to true the external tar
597 command is used if available; on Unix this is usually preferred
598 because they have a reliable and fast gnutar implementation.
599  
600 Use the external tar program instead of Archive::Tar?
601  
602 =item trust_test_report_history
603  
604 When a distribution has already been tested by CPAN::Reporter on
605 this machine, CPAN can skip the test phase and just rely on the
606 test report history instead.
607  
608 Note that this will not apply to distributions that failed tests
609 because of missing dependencies. Also, tests can be run
610 regardless of the history using "force".
611  
612 Do you want to rely on the test report history (yes/no)?
613  
614 =item urllist_ping_external
615  
616 When automatic selection of the nearest cpan mirrors is performed,
617 turn on the use of the external ping via Net::Ping::External. This is
618 recommended in the case the local network has a transparent proxy.
619  
620 Do you want to use the external ping command when autoselecting
621 mirrors?
622  
623 =item urllist_ping_verbose
624  
625 When automatic selection of the nearest cpan mirrors is performed,
626 this option can be used to turn on verbosity during the selection
627 process.
628  
629 Do you want to see verbosity turned on when autoselecting mirrors?
630  
631 =item use_prompt_default
632  
633 When this is true, CPAN will set PERL_MM_USE_DEFAULT to a true
634 value. This causes ExtUtils::MakeMaker (and compatible) prompts
635 to use default values instead of stopping to prompt you to answer
636 questions. It also sets NONINTERACTIVE_TESTING to a true value to
637 signal more generally that distributions should not try to
638 interact with you.
639  
640 Do you want to use prompt defaults (yes/no)?
641  
642 =item use_sqlite
643  
644 CPAN::SQLite is a layer between the index files that are downloaded
645 from the CPAN and CPAN.pm that speeds up metadata queries and reduces
646 memory consumption of CPAN.pm considerably.
647  
648 Use CPAN::SQLite if available? (yes/no)?
649  
650 =item use_static_install
651  
652 New feature as of CPAN 2.39 (2025-09), per default enabled: the module
653 CPAN::Static::Install knows how to install simple modules without
654 using either ExtUtils::MakeMaker or Module::Build. Modules that are
655 simple enough to be installed by CPAN::Static::Install declare that
656 with the attribute x_static_install in their META.yml or META.json
657 file.
658  
659 Use CPAN::Static::Install if available? (yes/no)?
660  
661 =item version_timeout
662  
663 This timeout prevents CPAN from hanging when trying to parse a
664 pathologically coded $VERSION from a module.
665  
666 The default is 15 seconds. If you set this value to 0, no timeout
667 will occur, but this is not recommended.
668  
669 Timeout for parsing module versions?
670  
671 =item yaml_load_code
672  
673 Both YAML.pm and YAML::Syck are capable of deserialising code. As this
674 requires a string eval, which might be a security risk, you can use
675 this option to enable or disable the deserialisation of code via
676 CPAN::DeferredCode. (Note: This does not work under perl 5.6)
677  
678 Do you want to enable code deserialisation (yes/no)?
679  
680 =item yaml_module
681  
682 At the time of this writing (2009-03) there are three YAML
683 implementations working: YAML, YAML::Syck, and YAML::XS. The latter
684 two are faster but need a C compiler installed on your system. There
685 may be more alternative YAML conforming modules. When I tried two
686 other players, YAML::Tiny and YAML::Perl, they seemed not powerful
687 enough to work with CPAN.pm. This may have changed in the meantime.
688  
689 Which YAML implementation would you prefer?
690  
691 =back
692  
693 =head1 LICENSE
694  
695 This program is free software; you can redistribute it and/or
696 modify it under the same terms as Perl itself.
697  
698 =cut
699  
700 7 ▶use vars qw( %prompts );
Subroutine BEGIN: called CC=1 SCAR=0.0
701  
702 {
703  
704 7 my @prompts = (
705  
706 auto_config => qq{
707 CPAN.pm requires configuration, but most of it can be done automatically.
708 If you answer 'no' below, you will enter an interactive dialog for each
709 configuration option instead.
710  
711 Would you like to configure as much as possible automatically?},
712  
713 auto_pick => qq{
714 Would you like me to automatically choose some CPAN mirror
715 sites for you? (This means connecting to the Internet)},
716  
717 config_intro => qq{
718  
719 The following questions are intended to help you with the
720 configuration. The CPAN module needs a directory of its own to cache
721 important index files and maybe keep a temporary mirror of CPAN files.
722 This may be a site-wide or a personal directory.
723  
724 },
725  
726 # cpan_home => qq{ },
727  
728 cpan_home_where => qq{
729  
730 First of all, I'd like to create this directory. Where?
731  
732 },
733  
734 external_progs => qq{
735  
736 The CPAN module will need a few external programs to work properly.
737 Please correct me, if I guess the wrong path for a program. Don't
738 panic if you do not have some of them, just press ENTER for those. To
739 disable the use of a program, you can type a space followed by ENTER.
740  
741 },
742  
743 proxy_intro => qq{
744  
745 If you're accessing the net via proxies, you can specify them in the
746 CPAN configuration or via environment variables. The variable in
747 the \$CPAN::Config takes precedence.
748  
749 },
750  
751 proxy_user => qq{
752  
753 If your proxy is an authenticating proxy, you can store your username
754 permanently. If you do not want that, just press ENTER. You will then
755 be asked for your username in every future session.
756  
757 },
758  
759 proxy_pass => qq{
760  
761 Your password for the authenticating proxy can also be stored
762 permanently on disk. If this violates your security policy, just press
763 ENTER. You will then be asked for the password in every future
764 session.
765  
766 },
767  
768 urls_intro => qq{
769 Now you need to choose your CPAN mirror sites. You can let me
770 pick mirrors for you, you can select them from a list or you
771 can enter them by hand.
772 },
773  
774 urls_picker_intro => qq{First, pick a nearby continent and country by typing in the number(s)
775 in front of the item(s) you want to select. You can pick several of
776 each, separated by spaces. Then, you will be presented with a list of
777 URLs of CPAN mirrors in the countries you selected, along with
778 previously selected URLs. Select some of those URLs, or just keep the
779 old list. Finally, you will be prompted for any extra URLs -- file:,
780 ftp:, or http: -- that host a CPAN mirror.
781  
782 You should select more than one (just in case the first isn't available).
783  
784 },
785  
786 password_warn => qq{
787  
788 Warning: Term::ReadKey seems not to be available, your password will
789 be echoed to the terminal!
790  
791 },
792  
793 install_help => qq{
794 Warning: You do not have write permission for Perl library directories.
795  
796 To install modules, you need to configure a local Perl library directory or
797 escalate your privileges. CPAN can help you by bootstrapping the local::lib
798 module or by configuring itself to use 'sudo' (if available). You may also
799 resolve this problem manually if you need to customize your setup.
800  
801 What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
802 },
803  
804 local_lib_installed => qq{
805 local::lib is installed. You must now add the following environment variables
806 to your shell configuration files (or registry, if you are on Windows) and
807 then restart your command line shell and CPAN before installing modules:
808  
809 },
810  
811 );
812  
813 7 ▶ die "Coding error in \@prompts declaration. Odd number of elements, above"
Branch: 1 branch
BranchTrueFalseTotal
if @prompts % 2 0 7 7
814 if (@prompts % 2);
815  
816 7 %prompts = @prompts;
817  
818 7 ▶ if (scalar(keys %prompts) != scalar(@prompts)/2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %CPAN::FirstTime::prompts != scalar(@prompts) / 2) 0 7 7
819 0 my %already;
820 0 for my $item (0..$#prompts) {
821 0 ▶ next if $item % 2;
Branch: 1 branch
BranchTrueFalseTotal
if $item % 2 0 0 0
822 0 ▶ die "$prompts[$item] is duplicated\n" if $already{$prompts[$item]}++;
Branch: 1 branch
BranchTrueFalseTotal
if $already{$prompts[$item]}++ 0 0 0
823 }
824 }
825  
826 7 shift @podpara;
827 7 ▶ while (@podpara) {
Branch: 1 branch
BranchTrueFalseTotal
if (@podpara) 448 7 455
828 448 ▶ warn "Alert: cannot parse my own manpage for init dialog" unless $podpara[0] =~ s/^=item\s+//;
Branch: 1 branch
BranchTrueFalseTotal
unless $podpara[0] =~ s/^=item\s+// 0 448 448
829 448 my $name = shift @podpara;
830 448 my @para;
831 448 ▶ while (@podpara && $podpara[0] !~ /^=item/) {
Branch: 1 branch
BranchTrueFalseTotal
if (@podpara and not $podpara[0] =~ /^=item/) 1036 448 1484
Condition100%3/3
@podpara and not $podpara[0] =~ /^=item/
!ll&&!rl&&r
74411036
MC/DC100%2/2
@podpara and not $podpara[0] =~ /^=item/
@podpara not $podpara[0] =~ /^=item/
Truth table100%3/3
A and not(B)
A= @podparaB= not $podpara[0] =~ /^=item/
ABresult
0X0
100
111
832 1036 push @para, shift @podpara;
833 }
834 448 $prompts{$name} = pop @para;
835 448 ▶ if (@para) {
Branch: 1 branch
BranchTrueFalseTotal
if (@para) 392 56 448
836 392 $prompts{$name . "_intro"} = join "", map { "$_\n\n" } @para;
837 }
838 }
839  
840 }
841  
842 2 ▶sub init {
Subroutine init: called CC=135 SCAR=74.8
Pod undocumented
843 2 my($configpm, %args) = @_;
844 7 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
845 # extra args after 'o conf init'
846 2 ▶ my $matcher = $args{args} && @{$args{args}} ? $args{args}[0] : '';
Branch: 1 branch
BranchTrueFalseTotal
$args{'args'} && @{$args{'args'};} ? : 1 1 2
Condition66%2/3
$args{"args"} and @{$args{"args"};}
!ll&&!rl&&r
011
MC/DC50%1/2
$args{"args"} and @{$args{"args"};}
$args{"args"} @{$args{"args"};}
Truth table66%2/3
A and B
A= $args{"args"}B= @{$args{"args"};}
ABresult
0X0
100
111
847 2 ▶ if ($matcher =~ /^\/(.*)\/$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($matcher =~ m[^/(.*)/$]) { } 0 2 2
elsif (0 == length $matcher) { } 1 1 2
848 # case /regex/ => take the first, ignore the rest
849 0 $matcher = $1;
850 0 shift @{$args{args}};
851 0 ▶ if (@{$args{args}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$args{"args"};}) 0 0 0
852 0 local $" = " ";
853 0 $CPAN::Frontend->mywarn("Ignoring excessive arguments '@{$args{args}}'");
854 0 $CPAN::Frontend->mysleep(2);
855 }
856 } elsif (0 == length $matcher) {
857 } elsif (0 && $matcher eq "~") { # extremely buggy, but a nice idea
858 my @unconfigured = sort grep { not exists $CPAN::Config->{$_}
859 or not defined $CPAN::Config->{$_}
860 or not length $CPAN::Config->{$_}
861 } keys %$CPAN::Config;
862 $matcher = "\\b(".join("|", @unconfigured).")\\b";
863 $CPAN::Frontend->mywarn("matcher[$matcher]");
864 } else {
865 # case WORD... => all arguments must be valid
866 1 for my $arg (@{$args{args}}) {
867 1 ▶ unless (exists $CPAN::HandleConfig::keys{$arg}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $CPAN::HandleConfig::keys{$arg}) 0 1 1
868 0 $CPAN::Frontend->mywarn("'$arg' is not a valid configuration variable\n");
869 0 return;
870 }
871 }
872 1 $matcher = "\\b(".join("|",@{$args{args}}).")\\b";
873 }
874 2 ▶ CPAN->debug("matcher[$matcher]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 2 2
875  
876 2 ▶ unless ($CPAN::VERSION) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::VERSION) 0 2 2
877 0 require CPAN::Nox;
878 }
879 2 require CPAN::HandleConfig;
880 2 CPAN::HandleConfig::require_myconfig_or_config();
881 2 ▶ $CPAN::Config ||= {};
Condition50%1/2
$CPAN::Config ||= {}
l!l
20
MC/DC0%0/1
$CPAN::Config ||= {}
$CPAN::Config
Truth table50%1/2
A
A= $CPAN::Config
Aresult
11
00
882 2 local($/) = "\n";
883 2 local($\) = "";
884 2 local($|) = 1;
885  
886 2 my($ans,$default); # why so half global?
887  
888 #
889 #= Files, directories
890 #
891  
892 2 local *_real_prompt;
893 2 ▶ if ( $args{autoconfig} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($args{'autoconfig'}) { } 0 2 2
elsif ($matcher) { } 1 1 2
894 0 $auto_config = 1;
895 } elsif ($matcher) {
896 1 $auto_config = 0;
897 } else {
898 1 my $_conf = prompt($prompts{auto_config}, "yes");
899 1 ▶ $auto_config = ($_conf and $_conf =~ /^y/i) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$_conf && $_conf =~ /^y/i ? : 1 0 1
Condition33%1/3
$_conf and $_conf =~ /^y/i
!ll&&!rl&&r
001
MC/DC0%0/2
$_conf and $_conf =~ /^y/i
$_conf $_conf =~ /^y/i
Truth table33%1/3
A and B
A= $_confB= $_conf =~ /^y/i
ABresult
0X0
100
111
900 }
901 2 ▶ CPAN->debug("auto_config[$auto_config]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 2 2
902 2 ▶ if ( $auto_config ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::FirstTime::auto_config) 1 1 2
903 1 local $^W = 0;
904 # prototype should match that of &MakeMaker::prompt
905 1 my $current_second = time;
906 1 my $current_second_count = 0;
907 1 my $i_am_mad = 0;
908 # silent prompting -- just quietly use default
909 1 ▶ *_real_prompt = sub { return $_[1] };
Subroutine __ANON__: called CC=1 SCAR=0.0
910 }
911  
912 #
913 # bootstrap local::lib or sudo
914 #
915 2 ▶ unless ( $matcher
Branch: 1 branch
BranchTrueFalseTotal
unless ($matcher or _can_write_to_libdirs() or _using_installbase() or _using_sudo()) 1 1 2
Condition66%6/9
$matcher or _can_write_to_libdirs() or _using_installbase() or _using_sudo()
l!l&&r!l&&!r
101
$matcher or _can_write_to_libdirs() or _using_installbase()
l!l&&r!l&&!r
101
$matcher or _can_write_to_libdirs()
l!l&&r!l&&!r
101
MC/DC25%1/4
$matcher or _can_write_to_libdirs() or _using_installbase() or _using_sudo()
$matcher _can_write_to_libdirs() _using_installbase() _using_sudo()
Truth table40%2/5
A or B or C or D
A= $matcherB= _can_write_to_libdirs()C= _using_installbase()D= _using_sudo()
ABCDresult
1XXX1
01XX1
001X1
00011
00000
916 || _can_write_to_libdirs() || _using_installbase() || _using_sudo()
917 ) {
918 1 local $auto_config = 0; # We *must* ask, even under autoconfig
919 1 local *_real_prompt; # We *must* show prompt
920 1 my_prompt_loop(install_help => 'local::lib', $matcher,
921 'local::lib|sudo|manual');
922 }
923 2 ▶ $CPAN::Config->{install_help} ||= ''; # Temporary to suppress warnings
Condition100%2/2
$CPAN::Config->{"install_help"} ||= ""
l!l
11
MC/DC100%1/1
$CPAN::Config->{"install_help"} ||= ""
$CPAN::Config->{"install_help"}
Truth table100%2/2
A
A= $CPAN::Config->{"install_help"}
Aresult
11
00
924  
925 2 ▶ if (!$matcher or q{
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or "\n build_dir\n build_dir_reuse\n cpan_home\n keep_source_where\n prefs_dir\n " =~ /$matcher/) 1 1 2
Condition66%2/3
not $matcher or "\n build_dir\n build_dir_reuse\n cpan_home\n keep_source_where\n prefs_dir\n " =~ /$matcher/
l!l&&r!l&&!r
101
MC/DC50%1/2
not $matcher or "\n build_dir\n build_dir_reuse\n cpan_home\n keep_source_where\n prefs_dir\n " =~ /$matcher/
not $matcher "\n build_dir\n build_dir_reuse\n cpan_home\n keep_source_where\n prefs_dir\n " =~ /$matcher/
Truth table66%2/3
not(A) or B
A= not $matcherB= "\n build_dir\n build_dir_reuse\n cpan_home\n keep_source_where\n prefs_dir\n " =~ /$matcher/
ABresult
1X1
011
000
926 build_dir
927 build_dir_reuse
928 cpan_home
929 keep_source_where
930 prefs_dir
931 } =~ /$matcher/) {
932 1 ▶ $CPAN::Frontend->myprint($prompts{config_intro}) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 1 1
933  
934 1 init_cpan_home($matcher);
935  
936 my_dflt_prompt("keep_source_where",
937 1 File::Spec->catdir($CPAN::Config->{cpan_home},"sources"),
938 $matcher,
939 );
940 my_dflt_prompt("build_dir",
941 1 File::Spec->catdir($CPAN::Config->{cpan_home},"build"),
942 $matcher
943 );
944 1 my_yn_prompt(build_dir_reuse => 0, $matcher);
945 my_dflt_prompt("prefs_dir",
946 1 File::Spec->catdir($CPAN::Config->{cpan_home},"prefs"),
947 $matcher
948 );
949 }
950  
951 #
952 #= Config: auto_commit
953 #
954  
955 2 my_yn_prompt(auto_commit => 0, $matcher);
956  
957 #
958 #= Cache size, Index expire
959 #
960 2 my_dflt_prompt(build_cache => 100, $matcher);
961  
962 2 my_dflt_prompt(index_expire => 1, $matcher);
963 2 my_prompt_loop(scan_cache => 'atstart', $matcher, 'atstart|atexit|never');
964 2 my_yn_prompt(cleanup_after_install => 0, $matcher);
965  
966 #
967 #= cache_metadata
968 #
969  
970 2 my_yn_prompt(cache_metadata => 1, $matcher);
971 2 my_yn_prompt(use_sqlite => 0, $matcher);
972  
973 #
974 #= Do we follow PREREQ_PM?
975 #
976  
977 2 my_prompt_loop(prerequisites_policy => 'follow', $matcher,
978 'follow|ask|ignore');
979 2 my_prompt_loop(build_requires_install_policy => 'yes', $matcher,
980 'yes|no|ask/yes|ask/no');
981 2 my_yn_prompt(recommends_policy => 1, $matcher);
982 2 my_yn_prompt(suggests_policy => 0, $matcher);
983  
984 #
985 #= Module::Signature
986 #
987 2 my_yn_prompt(check_sigs => 0, $matcher);
988  
989 #
990 #= CPAN::Reporter
991 #
992 2 ▶ if (!$matcher or 'test_report' =~ /$matcher/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or "test_report" =~ /$matcher/) 1 1 2
Condition66%2/3
not $matcher or "test_report" =~ /$matcher/
l!l&&r!l&&!r
101
MC/DC50%1/2
not $matcher or "test_report" =~ /$matcher/
not $matcher "test_report" =~ /$matcher/
Truth table66%2/3
not(A) or B
A= not $matcherB= "test_report" =~ /$matcher/
ABresult
1X1
011
000
993 1 my_yn_prompt(test_report => 0, $matcher);
994 1 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($matcher and $CPAN::Config->{"test_report"} and $CPAN::META->has_inst("CPAN::Reporter") and "CPAN::Reporter"->can("configure")) 0 1 1
Condition33%3/9
$matcher and $CPAN::Config->{"test_report"} and $CPAN::META->has_inst("CPAN::Reporter") and "CPAN::Reporter"->can("configure")
!ll&&!rl&&r
100
$matcher and $CPAN::Config->{"test_report"} and $CPAN::META->has_inst("CPAN::Reporter")
!ll&&!rl&&r
100
$matcher and $CPAN::Config->{"test_report"}
!ll&&!rl&&r
100
MC/DC0%0/4
$matcher and $CPAN::Config->{"test_report"} and $CPAN::META->has_inst("CPAN::Reporter") and "CPAN::Reporter"->can("configure")
$matcher $CPAN::Config->{"test_report"} $CPAN::META->has_inst("CPAN::Reporter") "CPAN::Reporter"->can("configure")
Truth table20%1/5
A and B and C and D
A= $matcherB= $CPAN::Config->{"test_report"}C= $CPAN::META->has_inst("CPAN::Reporter")D= "CPAN::Reporter"->can("configure")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
995 $matcher &&
996 $CPAN::Config->{test_report} &&
997 $CPAN::META->has_inst("CPAN::Reporter") &&
998 CPAN::Reporter->can('configure')
999 ) {
1000 0 my $_conf = prompt("Would you like me configure CPAN::Reporter now?", "yes");
1001 0 ▶ if ($_conf =~ /^y/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_conf =~ /^y/i) 0 0 0
1002 0 $CPAN::Frontend->myprint("\nProceeding to configure CPAN::Reporter.\n");
1003 0 CPAN::Reporter::configure();
1004 0 $CPAN::Frontend->myprint("\nReturning to CPAN configuration.\n");
1005 }
1006 }
1007 }
1008  
1009 2 my_yn_prompt(trust_test_report_history => 0, $matcher);
1010  
1011 #
1012 #= YAML vs. YAML::Syck
1013 #
1014 2 ▶ if (!$matcher or "yaml_module" =~ /$matcher/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or "yaml_module" =~ /$matcher/) 1 1 2
Condition66%2/3
not $matcher or "yaml_module" =~ /$matcher/
l!l&&r!l&&!r
101
MC/DC50%1/2
not $matcher or "yaml_module" =~ /$matcher/
not $matcher "yaml_module" =~ /$matcher/
Truth table66%2/3
not(A) or B
A= not $matcherB= "yaml_module" =~ /$matcher/
ABresult
1X1
011
000
1015 1 my_dflt_prompt(yaml_module => "YAML", $matcher);
1016 1 my $old_v = $CPAN::Config->{load_module_verbosity};
1017 1 $CPAN::Config->{load_module_verbosity} = q[none];
1018 1 ▶ if (!$auto_config && !$CPAN::META->has_inst($CPAN::Config->{yaml_module})) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::FirstTime::auto_config or $CPAN::META->has_inst($CPAN::Config->{"yaml_module"})) 0 1 1
Condition33%1/3
$CPAN::FirstTime::auto_config or $CPAN::META->has_inst($CPAN::Config->{"yaml_module"})
l!l&&r!l&&!r
100
MC/DC0%0/2
$CPAN::FirstTime::auto_config or $CPAN::META->has_inst($CPAN::Config->{"yaml_module"})
$CPAN::FirstTime::auto_config $CPAN::META->has_inst($CPAN::Config->{"yaml_module"})
Truth table33%1/3
A or B
A= $CPAN::FirstTime::auto_configB= $CPAN::META->has_inst($CPAN::Config->{"yaml_module"})
ABresult
1X1
011
000
1019 0 $CPAN::Frontend->mywarn
1020 ("Warning (maybe harmless): '$CPAN::Config->{yaml_module}' not installed.\n");
1021 0 $CPAN::Frontend->mysleep(3);
1022 }
1023 1 $CPAN::Config->{load_module_verbosity} = $old_v;
1024 }
1025  
1026 #
1027 #= YAML code deserialisation
1028 #
1029 2 my_yn_prompt(yaml_load_code => 0, $matcher);
1030  
1031 #
1032 #= External programs
1033 #
1034 2 my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'};
1035 $CPAN::Frontend->myprint($prompts{external_progs})
1036 2 ▶ if !$matcher && !$auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $matcher or $CPAN::FirstTime::auto_config 0 2 2
Condition66%2/3
$matcher or $CPAN::FirstTime::auto_config
l!l&&r!l&&!r
110
MC/DC0%0/2
$matcher or $CPAN::FirstTime::auto_config
$matcher $CPAN::FirstTime::auto_config
Truth table66%2/3
A or B
A= $matcherB= $CPAN::FirstTime::auto_config
ABresult
1X1
011
000
1037 2 _init_external_progs($matcher, {
1038 path => \@path,
1039 progs => [ qw/make bzip2 gzip tar unzip gpg patch applypatch/ ],
1040 shortcut => 0
1041 });
1042 2 _init_external_progs($matcher, {
1043 path => \@path,
1044 progs => [ qw/wget curl lynx ncftpget ncftp ftp/ ],
1045 shortcut => 1
1046 });
1047  
1048 {
1049 my $path = $CPAN::Config->{'pager'} ||
1050 2 ▶ $ENV{PAGER} || find_exe("less",\@path) ||
Condition38%5/13
$CPAN::Config->{'pager'} || $ENV{'PAGER'} || find_exe('less', \@path) || find_exe('more', \@path) || 0 || 'more'
l!l
20
$CPAN::Config->{"pager"} or $ENV{"PAGER"} or find_exe("less", \@path) or find_exe("more", \@path) or 0
l!l
20
$CPAN::Config->{"pager"} or $ENV{"PAGER"} or find_exe("less", \@path) or find_exe("more", \@path)
l!l&&r!l&&!r
020
$CPAN::Config->{"pager"} or $ENV{"PAGER"} or find_exe("less", \@path)
l!l&&r!l&&!r
002
$CPAN::Config->{"pager"} or $ENV{"PAGER"}
l!l&&r!l&&!r
002
MC/DC0%0/4
$CPAN::Config->{'pager'} || $ENV{'PAGER'} || find_exe('less', \@path) || find_exe('more', \@path) || 0 || 'more'
$CPAN::Config->{"pager"} $ENV{"PAGER"} find_exe("less", \@path) find_exe("more", \@path)
Truth table20%1/5
A or B or C or D
A= $CPAN::Config->{"pager"}B= $ENV{"PAGER"}C= find_exe("less", \@path)D= find_exe("more", \@path)
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1051 find_exe("more",\@path) || 0
1052 || "more";
1053 2 my_dflt_prompt(pager => $path, $matcher);
1054 }
1055  
1056 {
1057 2 my $path = $CPAN::Config->{'shell'};
1058 2 ▶ if ($path && File::Spec->file_name_is_absolute($path)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path and "File::Spec"->file_name_is_absolute($path)) 0 2 2
Condition33%1/3
$path and "File::Spec"->file_name_is_absolute($path)
!ll&&!rl&&r
200
MC/DC0%0/2
$path and "File::Spec"->file_name_is_absolute($path)
$path "File::Spec"->file_name_is_absolute($path)
Truth table33%1/3
A and B
A= $pathB= "File::Spec"->file_name_is_absolute($path)
ABresult
0X0
100
111
1059 0 ▶ $CPAN::Frontend->mywarn("Warning: configured $path does not exist\n")
Branch: 1 branch
BranchTrueFalseTotal
unless -e $path 0 0 0
1060 unless -e $path;
1061 0 $path = "";
1062 }
1063 2 ▶ $path ||= $ENV{SHELL};
Condition33%1/3
$path ||= $ENV{"SHELL"}
l!l&&r!l&&!r
002
MC/DC0%0/2
$path ||= $ENV{"SHELL"}
$path $ENV{"SHELL"}
Truth table33%1/3
A ||= B
A= $pathB= $ENV{"SHELL"}
ABresult
1X1
011
000
1064 2 ▶ $path ||= $ENV{COMSPEC} if $^O eq "MSWin32";
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" 0 2 2
Condition0%0/3
$path ||= $ENV{"COMSPEC"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$path ||= $ENV{"COMSPEC"}
$path $ENV{"COMSPEC"}
Truth table0%0/3
A ||= B
A= $pathB= $ENV{"COMSPEC"}
ABresult
1X1
011
000
1065 2 ▶ $path ||= 'sh', $path =~ s,\\,/,g if $^O eq 'os2'; # Cosmetic only
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "os2" 0 2 2
Condition0%0/2
$path ||= "sh"
l!l
00
MC/DC0%0/1
$path ||= "sh"
$path
Truth table0%0/2
A
A= $path
Aresult
11
00
1066 2 my_dflt_prompt(shell => $path, $matcher);
1067 }
1068  
1069 {
1070 2 my $tar = $CPAN::Config->{tar};
1071 2 my $prefer_external_tar = $CPAN::Config->{prefer_external_tar}; # XXX not yet supported
1072 2 ▶ unless (defined $prefer_external_tar) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $prefer_external_tar) 2 0 2
1073 2 ▶ if ($^O =~ /(MSWin32|solaris)/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($^O =~ /(MSWin32|solaris)/) { } 0 2 2
elsif ($tar) { } 1 1 2
1074 # both have a record of broken tars
1075 0 $prefer_external_tar = 0;
1076 } elsif ($tar) {
1077 1 $prefer_external_tar = 1;
1078 } else {
1079 1 $prefer_external_tar = 0;
1080 }
1081 }
1082 2 my_yn_prompt(prefer_external_tar => $prefer_external_tar, $matcher);
1083 }
1084  
1085 #
1086 # verbosity
1087 #
1088  
1089 2 my_prompt_loop(tar_verbosity => 'none', $matcher,
1090 'none|v|vv');
1091 2 my_prompt_loop(load_module_verbosity => 'none', $matcher,
1092 'none|v');
1093 2 my_prompt_loop(perl5lib_verbosity => 'none', $matcher,
1094 'none|v');
1095 2 my_yn_prompt(inhibit_startup_message => 0, $matcher);
1096  
1097 #
1098 #= Installer, arguments to make etc.
1099 #
1100  
1101 2 my_prompt_loop(prefer_installer => 'MB', $matcher, 'MB|EUMM|RAND');
1102  
1103 2 ▶ if (!$matcher or 'makepl_arg make_arg' =~ /$matcher/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or "makepl_arg make_arg" =~ /$matcher/) 1 1 2
Condition66%2/3
not $matcher or "makepl_arg make_arg" =~ /$matcher/
l!l&&r!l&&!r
101
MC/DC50%1/2
not $matcher or "makepl_arg make_arg" =~ /$matcher/
not $matcher "makepl_arg make_arg" =~ /$matcher/
Truth table66%2/3
not(A) or B
A= not $matcherB= "makepl_arg make_arg" =~ /$matcher/
ABresult
1X1
011
000
1104 1 my_dflt_prompt(makepl_arg => "", $matcher);
1105 1 my_dflt_prompt(make_arg => "", $matcher);
1106 1 ▶ if ( $CPAN::Config->{makepl_arg} =~ /LIBS=|INC=/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"makepl_arg"} =~ /LIBS=|INC=/) 0 1 1
1107 0 $CPAN::Frontend->mywarn(
1108 "Warning: Using LIBS or INC in makepl_arg will likely break distributions\n" .
1109 "that specify their own LIBS or INC options in Makefile.PL.\n"
1110 );
1111 }
1112  
1113 }
1114  
1115 #
1116 #== use_static_install
1117 #
1118 2 my_yn_prompt(use_static_install => 1, $matcher);
1119  
1120 2 require CPAN::HandleConfig;
1121 2 ▶ if (exists $CPAN::HandleConfig::keys{make_install_make_command}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $CPAN::HandleConfig::keys{"make_install_make_command"}) 2 0 2
1122 # as long as Windows needs $self->_build_command, we cannot
1123 # support sudo on windows :-)
1124 2 ▶ my $default = $CPAN::Config->{make} || "";
Condition100%2/2
$CPAN::Config->{'make'} || ''
l!l
11
MC/DC100%1/1
$CPAN::Config->{'make'} || ''
$CPAN::Config->{'make'}
Truth table100%2/2
A
A= $CPAN::Config->{'make'}
Aresult
11
00
1125 2 ▶ if ( $default && $CPAN::Config->{install_help} eq 'sudo' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($default and $CPAN::Config->{"install_help"} eq "sudo") 0 2 2
Condition66%2/3
$default and $CPAN::Config->{"install_help"} eq "sudo"
!ll&&!rl&&r
110
MC/DC0%0/2
$default and $CPAN::Config->{"install_help"} eq "sudo"
$default $CPAN::Config->{"install_help"} eq "sudo"
Truth table66%2/3
A and B
A= $defaultB= $CPAN::Config->{"install_help"} eq "sudo"
ABresult
0X0
100
111
1126 0 ▶ if ( find_exe('sudo') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (find_exe('sudo')) { } 0 0 0
1127 0 $default = "sudo $default";
1128 delete $CPAN::Config->{make_install_make_command}
1129 0 ▶ unless $CPAN::Config->{make_install_make_command} =~ /sudo/;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::Config->{"make_install_make_command"} =~ /sudo/ 0 0 0
1130 }
1131 else {
1132 0 $CPAN::Frontend->mywarnonce("Could not find 'sudo' in PATH\n");
1133 }
1134 }
1135 2 my_dflt_prompt(make_install_make_command => $default, $matcher);
1136 }
1137  
1138 2 ▶ my_dflt_prompt(make_install_arg => $CPAN::Config->{make_arg} || "",
Condition50%1/2
$CPAN::Config->{'make_arg'} || ''
l!l
02
MC/DC0%0/1
$CPAN::Config->{'make_arg'} || ''
$CPAN::Config->{'make_arg'}
Truth table50%1/2
A
A= $CPAN::Config->{'make_arg'}
Aresult
11
00
1139 $matcher);
1140  
1141 2 my_dflt_prompt(mbuildpl_arg => "", $matcher);
1142 2 my_dflt_prompt(mbuild_arg => "", $matcher);
1143  
1144 2 ▶ if (exists $CPAN::HandleConfig::keys{mbuild_install_build_command}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"} and $^O ne "MSWin32") 2 0 2
Condition33%1/3
exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"} and $^O ne "MSWin32"
!ll&&!rl&&r
002
MC/DC0%0/2
exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"} and $^O ne "MSWin32"
exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"} $^O ne "MSWin32"
Truth table33%1/3
A and B
A= exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"}B= $^O ne "MSWin32"
ABresult
0X0
100
111
1145 and $^O ne "MSWin32") {
1146 # as long as Windows needs $self->_build_command, we cannot
1147 # support sudo on windows :-)
1148 2 ▶ my $default = $^O eq 'VMS' ? '@Build.com' : "./Build";
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'VMS' ? : 0 2 2
1149 2 ▶ if ( $CPAN::Config->{install_help} eq 'sudo' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"install_help"} eq "sudo") 0 2 2
1150 0 ▶ if ( find_exe('sudo') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (find_exe('sudo')) { } 0 0 0
1151 0 $default = "sudo $default";
1152 delete $CPAN::Config->{mbuild_install_build_command}
1153 0 ▶ unless $CPAN::Config->{mbuild_install_build_command} =~ /sudo/;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::Config->{"mbuild_install_build_command"} =~ /sudo/ 0 0 0
1154 }
1155 else {
1156 0 $CPAN::Frontend->mywarnonce("Could not find 'sudo' in PATH\n");
1157 }
1158 }
1159 2 my_dflt_prompt(mbuild_install_build_command => $default, $matcher);
1160 }
1161  
1162 2 my_dflt_prompt(mbuild_install_arg => "", $matcher);
1163  
1164 2 for my $o (qw(
1165 allow_installing_outdated_dists
1166 allow_installing_module_downgrades
1167 )) {
1168 4 my_prompt_loop($o => 'ask/no', $matcher,
1169 'yes|no|ask/yes|ask/no');
1170 }
1171  
1172 #
1173 #== use_prompt_default
1174 #
1175 2 my_yn_prompt(use_prompt_default => 0, $matcher);
1176  
1177 #
1178 #= Alarm period
1179 #
1180  
1181 2 my_dflt_prompt(inactivity_timeout => 0, $matcher);
1182 2 my_dflt_prompt(version_timeout => 15, $matcher);
1183  
1184 #
1185 #== halt_on_failure
1186 #
1187 2 my_yn_prompt(halt_on_failure => 0, $matcher);
1188  
1189 #
1190 #= Proxies
1191 #
1192  
1193 2 my @proxy_vars = qw/ftp_proxy http_proxy no_proxy/;
1194 2 my @proxy_user_vars = qw/proxy_user proxy_pass/;
1195 2 ▶ if (!$matcher or "@proxy_vars @proxy_user_vars" =~ /$matcher/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or ("@proxy_vars @proxy_user_vars") =~ /$matcher/) 1 1 2
Condition66%2/3
not $matcher or ("@proxy_vars @proxy_user_vars") =~ /$matcher/
l!l&&r!l&&!r
101
MC/DC50%1/2
not $matcher or ("@proxy_vars @proxy_user_vars") =~ /$matcher/
not $matcher ("@proxy_vars @proxy_user_vars") =~ /$matcher/
Truth table66%2/3
not(A) or B
A= not $matcherB= ("@proxy_vars @proxy_user_vars") =~ /$matcher/
ABresult
1X1
011
000
1196 1 ▶ $CPAN::Frontend->myprint($prompts{proxy_intro}) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 1 1
1197  
1198 1 for (@proxy_vars) {
1199 3 $prompts{$_} = "Your $_?";
1200 3 ▶ my_dflt_prompt($_ => $ENV{$_}||"", $matcher);
Condition50%1/2
$ENV{$_} || ''
l!l
03
MC/DC0%0/1
$ENV{$_} || ''
$ENV{$_}
Truth table50%1/2
A
A= $ENV{$_}
Aresult
11
00
1201 }
1202  
1203 1 ▶ if ($CPAN::Config->{ftp_proxy} ||
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"ftp_proxy"} or $CPAN::Config->{"http_proxy"}) 0 1 1
Condition33%1/3
$CPAN::Config->{"ftp_proxy"} or $CPAN::Config->{"http_proxy"}
l!l&&r!l&&!r
001
MC/DC0%0/2
$CPAN::Config->{"ftp_proxy"} or $CPAN::Config->{"http_proxy"}
$CPAN::Config->{"ftp_proxy"} $CPAN::Config->{"http_proxy"}
Truth table33%1/3
A or B
A= $CPAN::Config->{"ftp_proxy"}B= $CPAN::Config->{"http_proxy"}
ABresult
1X1
011
000
1204 $CPAN::Config->{http_proxy}) {
1205  
1206 0 ▶ $default = $CPAN::Config->{proxy_user} || $CPAN::LWP::UserAgent::USER || "";
Condition0%0/5
$CPAN::Config->{'proxy_user'} || $CPAN::LWP::UserAgent::USER || ''
l!l
00
$CPAN::Config->{"proxy_user"} or $CPAN::LWP::UserAgent::USER
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::Config->{'proxy_user'} || $CPAN::LWP::UserAgent::USER || ''
$CPAN::Config->{"proxy_user"} $CPAN::LWP::UserAgent::USER
Truth table0%0/3
A or B
A= $CPAN::Config->{"proxy_user"}B= $CPAN::LWP::UserAgent::USER
ABresult
1X1
011
000
1207  
1208 0 ▶ $CPAN::Frontend->myprint($prompts{proxy_user}) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1209  
1210 0 ▶ if ($CPAN::Config->{proxy_user} = prompt("Your proxy user id?",$default)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"proxy_user"} = &prompt("Your proxy user id?", $default)) 0 0 0
1211 0 ▶ $CPAN::Frontend->myprint($prompts{proxy_pass}) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1212  
1213 0 ▶ if ($CPAN::META->has_inst("Term::ReadKey")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Term::ReadKey')) { } 0 0 0
1214 0 Term::ReadKey::ReadMode("noecho");
1215 } else {
1216 0 ▶ $CPAN::Frontend->myprint($prompts{password_warn}) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1217 }
1218 0 $CPAN::Config->{proxy_pass} = prompt_no_strip("Your proxy password?");
1219 0 ▶ if ($CPAN::META->has_inst("Term::ReadKey")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Term::ReadKey")) 0 0 0
1220 0 Term::ReadKey::ReadMode("restore");
1221 }
1222 0 ▶ $CPAN::Frontend->myprint("\n\n") unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1223 }
1224 }
1225 }
1226  
1227 #
1228 #= how plugins work
1229 #
1230  
1231 # XXX MISSING: my_array_prompt to be used with plugins. We did something like this near
1232 # git log -p fd68f8f5e33f4cecea4fdb7abc5ee19c12f138f0..test-notest-test-dependency
1233 # Need to do similar steps for plugin_list. As long as we do not support it here, people
1234 # must use the cpan shell prompt to write something like
1235 # o conf plugin_list push CPAN::Plugin::Specfile=dir,/tmp/foo-20141013,...
1236 # o conf commit
1237  
1238 #
1239 #= how FTP works
1240 #
1241  
1242 2 my_yn_prompt(ftp_passive => 1, $matcher);
1243  
1244 #
1245 #= how cwd works
1246 #
1247  
1248 2 my_prompt_loop(getcwd => 'cwd', $matcher,
1249 'cwd|getcwd|fastcwd|getdcwd|backtickcwd');
1250  
1251 #
1252 #= the CPAN shell itself (prompt, color)
1253 #
1254  
1255 2 my_yn_prompt(commandnumber_in_prompt => 1, $matcher);
1256 2 my_yn_prompt(term_ornaments => 1, $matcher);
1257 2 ▶ if ("colorize_output colorize_print colorize_warn colorize_debug" =~ $matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if ("colorize_output colorize_print colorize_warn colorize_debug" =~ /$matcher/) 1 1 2
1258 1 my_yn_prompt(colorize_output => 0, $matcher);
1259 1 ▶ if ($CPAN::Config->{colorize_output}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"colorize_output"}) 0 1 1
1260 0 ▶ if ($CPAN::META->has_inst("Term::ANSIColor")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Term::ANSIColor")) 0 0 0
1261 0 my $T="gYw";
1262 0 ▶ $CPAN::Frontend->myprint( " on_ on_y ".
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1263 " on_ma on_\n") unless $auto_config;
1264 0 ▶ $CPAN::Frontend->myprint( " on_black on_red green ellow ".
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1265 "on_blue genta on_cyan white\n") unless $auto_config;
1266  
1267 0 for my $FG ("", "bold",
1268 0 map {$_,"bold $_"} "black","red","green",
1269 "yellow","blue",
1270 "magenta",
1271 "cyan","white") {
1272 0 ▶ $CPAN::Frontend->myprint(sprintf( "%12s ", $FG)) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1273 0 for my $BG ("",map {"on_$_"} qw(black red green yellow
1274 blue magenta cyan white)) {
1275 0 ▶ $CPAN::Frontend->myprint( $FG||$BG ?
Branch: 2 branches
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
$FG || $BG ? : 0 0 0
Condition0%0/3
$FG or $BG
l!l&&r!l&&!r
000
MC/DC0%0/2
$FG or $BG
$FG $BG
Truth table0%0/3
A or B
A= $FGB= $BG
ABresult
1X1
011
000
1276 Term::ANSIColor::colored(" $T ","$FG $BG") : " $T ") unless $auto_config;
1277 }
1278 0 ▶ $CPAN::Frontend->myprint( "\n" ) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1279 }
1280 0 ▶ $CPAN::Frontend->myprint( "\n" ) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1281 }
1282 0 for my $tuple (
1283 ["colorize_print", "bold blue on_white"],
1284 ["colorize_warn", "bold red on_white"],
1285 ["colorize_debug", "black on_cyan"],
1286 ) {
1287 0 my_dflt_prompt($tuple->[0] => $tuple->[1], $matcher);
1288 0 ▶ if ($CPAN::META->has_inst("Term::ANSIColor")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Term::ANSIColor")) 0 0 0
1289 0 eval { Term::ANSIColor::color($CPAN::Config->{$tuple->[0]})};
1290 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1291 0 $CPAN::Config->{$tuple->[0]} = $tuple->[1];
1292 0 $CPAN::Frontend->mywarn($@."setting to default '$tuple->[1]'\n");
1293 }
1294 }
1295 }
1296 }
1297 }
1298  
1299 #
1300 #== term_is_latin
1301 #
1302  
1303 2 my_yn_prompt(term_is_latin => 1, $matcher);
1304  
1305 #
1306 #== save history in file 'histfile'
1307 #
1308  
1309 2 ▶ if (!$matcher or 'histfile histsize' =~ /$matcher/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or "histfile histsize" =~ /$matcher/) 1 1 2
Condition66%2/3
not $matcher or "histfile histsize" =~ /$matcher/
l!l&&r!l&&!r
101
MC/DC50%1/2
not $matcher or "histfile histsize" =~ /$matcher/
not $matcher "histfile histsize" =~ /$matcher/
Truth table66%2/3
not(A) or B
A= not $matcherB= "histfile histsize" =~ /$matcher/
ABresult
1X1
011
000
1310 1 ▶ $CPAN::Frontend->myprint($prompts{histfile_intro}) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 1 1
1311 defined($default = $CPAN::Config->{histfile}) or
1312 1 ▶ $default = File::Spec->catfile($CPAN::Config->{cpan_home},"histfile");
Branch: 1 branch
BranchTrueFalseTotal
defined($default = $CPAN::Config->{"histfile"}) or $default = "File::Spec"->catfile($CPAN::Config->{"cpan_home"}, "histfile") 1 0 1
1313 1 my_dflt_prompt(histfile => $default, $matcher);
1314  
1315 1 ▶ if ($CPAN::Config->{histfile}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"histfile"}) 1 0 1
1316 1 ▶ defined($default = $CPAN::Config->{histsize}) or $default = 100;
Branch: 1 branch
BranchTrueFalseTotal
defined($default = $CPAN::Config->{"histsize"}) or $default = 100 1 0 1
1317 1 my_dflt_prompt(histsize => $default, $matcher);
1318 }
1319 }
1320  
1321 #
1322 #== do an ls on the m or the d command
1323 #
1324 2 my_yn_prompt(show_upload_date => 0, $matcher);
1325  
1326 #
1327 #== verbosity at the end of the r command
1328 #
1329 2 ▶ if (!$matcher
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or "show_unparsable_versions" =~ /$matcher/ or "show_zero_versions" =~ /$matcher/) 1 1 2
Condition66%4/6
not $matcher or "show_unparsable_versions" =~ /$matcher/ or "show_zero_versions" =~ /$matcher/
l!l&&r!l&&!r
101
not $matcher or "show_unparsable_versions" =~ /$matcher/
l!l&&r!l&&!r
101
MC/DC33%1/3
not $matcher or "show_unparsable_versions" =~ /$matcher/ or "show_zero_versions" =~ /$matcher/
not $matcher "show_unparsable_versions" =~ /$matcher/ "show_zero_versions" =~ /$matcher/
Truth table50%2/4
not(A) or B or C
A= not $matcherB= "show_unparsable_versions" =~ /$matcher/C= "show_zero_versions" =~ /$matcher/
ABCresult
1XX1
01X1
0011
0000
1330 or 'show_unparsable_versions' =~ /$matcher/
1331 or 'show_zero_versions' =~ /$matcher/
1332 ) {
1333 1 my_yn_prompt(show_unparsable_versions => 0, $matcher);
1334 1 my_yn_prompt(show_zero_versions => 0, $matcher);
1335 }
1336  
1337 #
1338 #= MIRRORED.BY and conf_sites()
1339 #
1340  
1341 # Let's assume they want to use the internet and make them turn it
1342 # off if they really don't.
1343 2 my_yn_prompt("connect_to_internet_ok" => 1, $matcher);
1344 2 my_yn_prompt("pushy_https" => 1, $matcher);
1345  
1346 # Allow matching but don't show during manual config
1347 2 ▶ if ($matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if ($matcher) 1 1 2
1348 1 ▶ if ("urllist_ping_external" =~ $matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if ("urllist_ping_external" =~ /$matcher/) 0 1 1
1349 0 my_yn_prompt(urllist_ping_external => 0, $matcher);
1350 }
1351 1 ▶ if ("urllist_ping_verbose" =~ $matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if ("urllist_ping_verbose" =~ /$matcher/) 0 1 1
1352 0 my_yn_prompt(urllist_ping_verbose => 0, $matcher);
1353 }
1354 1 ▶ if ("randomize_urllist" =~ $matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if ("randomize_urllist" =~ /$matcher/) 0 1 1
1355 0 my_dflt_prompt(randomize_urllist => 0, $matcher);
1356 }
1357 1 ▶ if ("ftpstats_size" =~ $matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if ("ftpstats_size" =~ /$matcher/) 0 1 1
1358 0 my_dflt_prompt(ftpstats_size => 99, $matcher);
1359 }
1360 1 ▶ if ("ftpstats_period" =~ $matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if ("ftpstats_period" =~ /$matcher/) 0 1 1
1361 0 my_dflt_prompt(ftpstats_period => 14, $matcher);
1362 }
1363 }
1364  
1365 2 ▶ $CPAN::Config->{urllist} ||= [];
Condition50%1/2
$CPAN::Config->{"urllist"} ||= []
l!l
20
MC/DC0%0/1
$CPAN::Config->{"urllist"} ||= []
$CPAN::Config->{"urllist"}
Truth table50%1/2
A
A= $CPAN::Config->{"urllist"}
Aresult
11
00
1366  
1367 2 ▶ if ($auto_config) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::FirstTime::auto_config) { } 1 1 2
elsif (not $matcher or 'urllist' =~ /$matcher/) { } 1 0 1
1368 1 ▶ if(@{ $CPAN::Config->{urllist} }) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$CPAN::Config->{'urllist'};}) { } 1 0 1
1369 1 $CPAN::Frontend->myprint(
1370 "Your 'urllist' is already configured. Type 'o conf init urllist' to change it.\n"
1371 );
1372 }
1373 else {
1374 # Hint: as of 2021-11: to get http, use http://www.cpan.org/
1375 0 $CPAN::Config->{urllist} = [ 'https://www.cpan.org/' ];
1376 0 $CPAN::Frontend->myprint(
1377 0 "We initialized your 'urllist' to @{$CPAN::Config->{urllist}}. Type 'o conf init urllist' to change it.\n"
1378 );
1379 }
1380 }
1381 ▶ elsif (!$matcher || "urllist" =~ $matcher) {
Condition33%1/3
not $matcher or "urllist" =~ /$matcher/
l!l&&r!l&&!r
010
MC/DC0%0/2
not $matcher or "urllist" =~ /$matcher/
not $matcher "urllist" =~ /$matcher/
Truth table33%1/3
not(A) or B
A= not $matcherB= "urllist" =~ /$matcher/
ABresult
1X1
011
000
1382 1 _do_pick_mirrors();
1383 }
1384  
1385 2 ▶ if ($auto_config) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::FirstTime::auto_config) 1 1 2
1386 1 $CPAN::Frontend->myprint(
1387 "\nAutoconfiguration complete.\n"
1388 );
1389 1 $auto_config = 0; # reset
1390 }
1391  
1392 # bootstrap local::lib now if requested
1393 2 ▶ if ( $CPAN::Config->{install_help} eq 'local::lib' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"install_help"} eq "local::lib") 1 1 2
1394 1 ▶ if ( ! @{ $CPAN::Config->{urllist} } ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not @{$CPAN::Config->{'urllist'};}) { } 0 1 1
elsif (not $CPAN::Config->{'make'}) { } 0 1 1
1395 0 $CPAN::Frontend->myprint(
1396 "\nALERT: Skipping local::lib bootstrap because 'urllist' is not configured.\n"
1397 );
1398 }
1399 elsif (! $CPAN::Config->{make} ) {
1400 0 $CPAN::Frontend->mywarn(
1401 "\nALERT: Skipping local::lib bootstrap because 'make' is not configured.\n"
1402 );
1403 0 _beg_for_make(); # repetitive, but we don't want users to miss it
1404 }
1405 else {
1406 1 $CPAN::Frontend->myprint("\nAttempting to bootstrap local::lib...\n");
1407 1 $CPAN::Frontend->myprint("\nWriting $configpm for bootstrap...\n");
1408 1 delete $CPAN::Config->{install_help}; # temporary only
1409 1 CPAN::HandleConfig->commit;
1410 1 my($dist, $locallib);
1411 1 $locallib = CPAN::Shell->expand('Module', 'local::lib');
1412 0 ▶ if ( $locallib and $dist = $locallib->distribution ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locallib and $dist = $locallib->distribution) 0 0 0
Condition0%0/3
$locallib and $dist = $locallib->distribution
!ll&&!rl&&r
000
MC/DC0%0/2
$locallib and $dist = $locallib->distribution
$locallib $dist = $locallib->distribution
Truth table0%0/3
A and B
A= $locallibB= $dist = $locallib->distribution
ABresult
0X0
100
111
1413 # this is a hack to force bootstrapping
1414 0 $dist->{prefs}{pl}{commandline} = "$^X Makefile.PL --bootstrap";
1415 # Set @INC for this process so we find things as they bootstrap
1416 0 require lib;
1417 0 lib->import(_local_lib_inc_path());
1418 0 eval { $dist->install };
1419 }
1420 0 ▶ if ( ! $dist || (my $err = $@) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $dist or my $err = $@) { } 0 0 0
Condition0%0/3
not $dist or my $err = $@
l!l&&r!l&&!r
000
MC/DC0%0/2
not $dist or my $err = $@
not $dist my $err = $@
Truth table0%0/3
not(A) or B
A= not $distB= my $err = $@
ABresult
1X1
011
000
1421 0 ▶ $err ||= 'Could not locate local::lib in the CPAN index';
Condition0%0/2
$err ||= "Could not locate local::lib in the CPAN index"
l!l
00
MC/DC0%0/1
$err ||= "Could not locate local::lib in the CPAN index"
$err
Truth table0%0/2
A
A= $err
Aresult
11
00
1422 0 $CPAN::Frontend->mywarn("Error bootstrapping local::lib: $@\n");
1423 0 $CPAN::Frontend->myprint("From the CPAN Shell, you might try 'look local::lib' and \n"
1424 . "run 'perl Makefile --bootstrap' and see if that is successful. Then\n"
1425 . "restart your CPAN client\n"
1426 );
1427 }
1428 else {
1429 0 _local_lib_config();
1430 }
1431 }
1432 }
1433  
1434 # install_help is temporary for configuration and not saved
1435 1 delete $CPAN::Config->{install_help};
1436  
1437 1 $CPAN::Frontend->myprint("\n");
1438 1 ▶ if ($matcher && !$CPAN::Config->{auto_commit}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($matcher and not $CPAN::Config->{'auto_commit'}) { } 1 0 1
Condition33%1/3
$matcher and not $CPAN::Config->{"auto_commit"}
!ll&&!rl&&r
001
MC/DC0%0/2
$matcher and not $CPAN::Config->{"auto_commit"}
$matcher not $CPAN::Config->{"auto_commit"}
Truth table33%1/3
A and not(B)
A= $matcherB= not $CPAN::Config->{"auto_commit"}
ABresult
0X0
100
111
1439 1 $CPAN::Frontend->myprint("Please remember to call 'o conf commit' to ".
1440 "make the config permanent!\n");
1441 } else {
1442 0 CPAN::HandleConfig->commit;
1443 }
1444  
1445 1 ▶ if (! $matcher) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher) 0 1 1
1446 0 $CPAN::Frontend->myprint(
1447 "\nYou can re-run configuration any time with 'o conf init' in the CPAN shell\n"
1448 );
1449 }
1450  
1451 }
1452  
1453 0 ▶sub _local_lib_config {
Subroutine _local_lib_config: not called CC=6 SCAR=37.4
1454 # Set environment stuff for this process
1455 0 require local::lib;
1456  
1457 # Tell user about environment vars to set
1458 0 $CPAN::Frontend->myprint($prompts{local_lib_installed});
1459 0 ▶ local $ENV{SHELL} = $CPAN::Config->{shell} || $ENV{SHELL};
Condition0%0/3
$CPAN::Config->{'shell'} || $ENV{'SHELL'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::Config->{'shell'} || $ENV{'SHELL'}
$CPAN::Config->{'shell'} $ENV{'SHELL'}
Truth table0%0/3
A || B
A= $CPAN::Config->{'shell'}B= $ENV{'SHELL'}
ABresult
1X1
011
000
1460 0 my $shellvars = local::lib->environment_vars_string_for(_local_lib_path());
1461 0 $CPAN::Frontend->myprint($shellvars);
1462  
1463 # Set %ENV after getting string above
1464 0 my %env = local::lib->build_environment_vars_for(_local_lib_path(), 1);
1465 0 ▶ while ( my ($k, $v) = each %env ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %env) 0 0 0
1466 0 $ENV{$k} = $v;
1467 }
1468  
1469 # Offer to mangle the shell config
1470 0 my $munged_rc;
1471 0 ▶ if ( my $rc = _find_shell_config() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $rc = _find_shell_config()) 0 0 0
1472 0 local $auto_config = 0; # We *must* ask, even under autoconfig
1473 0 local *_real_prompt; # We *must* show prompt
1474 0 my $_conf = prompt(
1475 "\nWould you like me to append that to $rc now?", "yes"
1476 );
1477 0 ▶ if ($_conf =~ /^y/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_conf =~ /^y/i) 0 0 0
1478 0 open my $fh, ">>", $rc;
1479 0 print {$fh} "\n$shellvars";
1480 0 close $fh;
1481 0 $munged_rc++;
1482 }
1483 }
1484  
1485 # Warn at exit time
1486 0 ▶ if ($munged_rc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($munged_rc) { } 0 0 0
1487 0 push @{$CPAN::META->_exit_messages}, << "HERE";
1488  
1489 *** Remember to restart your shell before running cpan again ***
1490 HERE
1491 }
1492 else {
1493 0 push @{$CPAN::META->_exit_messages}, << "HERE";
1494  
1495 *** Remember to add these environment variables to your shell config
1496 and restart your shell before running cpan again ***
1497  
1498 $shellvars
1499 HERE
1500 }
1501 }
1502  
1503 {
1504 my %shell_rc_map = (
1505 91 map { $_ => ".${_}rc" } qw/ bash tcsh csh /,
1506 7 map { $_ => ".profile" } qw/dash ash sh/,
1507 zsh => ".zshenv",
1508 );
1509  
1510 0 ▶ sub _find_shell_config {
Subroutine _find_shell_config: not called CC=3 SCAR=24.8
1511 0 my $shell = File::Basename::basename($CPAN::Config->{shell});
1512 0 ▶ if ( my $rc = $shell_rc_map{$shell} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $rc = $shell_rc_map{$shell}) 0 0 0
1513 0 my $path = File::Spec->catfile($ENV{HOME}, $rc);
1514 0 ▶ return $path if -w $path;
Branch: 1 branch
BranchTrueFalseTotal
if -w $path 0 0 0
1515 }
1516 }
1517 }
1518  
1519  
1520 7 ▶sub _local_lib_inc_path {
Subroutine _local_lib_inc_path: not called CC=1 SCAR=1.2
1521 0 return File::Spec->catdir(_local_lib_path(), qw/lib perl5/);
1522 }
1523  
1524 0 ▶sub _local_lib_path {
Subroutine _local_lib_path: not called CC=1 SCAR=6.9
1525 0 return File::Spec->catdir(_local_lib_home(), 'perl5');
1526 }
1527  
1528 # Adapted from resolve_home_path() in local::lib -- this is where
1529 # local::lib thinks the user's home is
1530 {
1531 7 my $local_lib_home;
1532 0 ▶ sub _local_lib_home {
Subroutine _local_lib_home: not called CC=6 SCAR=37.4
1533 0 ▶ $local_lib_home ||= File::Spec->rel2abs( do {
Condition0%0/3
$local_lib_home ||= "File::Spec"->rel2abs(do { if ($CPAN::META->has_usable("File::HomeDir") and "File::HomeDir"->VERSION >= "0.65") { "File::HomeDir"->my_home; } elsif (defined $ENV{"HOME"}) { $ENV{"HOME"}; } else { (getpwuid $<)[7] or "~"; } })
l!l&&r!l&&!r
000
MC/DC0%0/2
$local_lib_home ||= "File::Spec"->rel2abs(do { if ($CPAN::META->has_usable("File::HomeDir") and "File::HomeDir"->VERSION >= "0.65") { "File::HomeDir"->my_home; } elsif (defined $ENV{"HOME"}) { $ENV{"HOME"}; } else { (getpwuid $<)[7] or "~"; } })
$local_lib_home "File::Spec"->rel2abs(do { if ($CPAN::META->has_usable("File::HomeDir") and "File::HomeDir"->VERSION >= "0.65") { "File::HomeDir"->my_home; } elsif (defined $ENV{"HOME"}) { $ENV{"HOME"}; } else { (getpwuid $<)[7] or "~"; } })
Truth table0%0/3
A ||= B
A= $local_lib_homeB= "File::Spec"->rel2abs(do { if ($CPAN::META->has_usable("File::HomeDir") and "File::HomeDir"->VERSION >= "0.65") { "File::HomeDir"->my_home; } elsif (defined $ENV{"HOME"}) { $ENV{"HOME"}; } else { (getpwuid $<)[7] or "~"; } })
ABresult
1X1
011
000
1534 0 ▶ if ($CPAN::META->has_usable("File::HomeDir") && File::HomeDir->VERSION >= 0.65) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_usable('File::HomeDir') and 'File::HomeDir'->VERSION >= 0.65) { } 0 0 0
elsif (defined $ENV{'HOME'}) { } 0 0 0
Condition0%0/3
$CPAN::META->has_usable("File::HomeDir") and "File::HomeDir"->VERSION >= "0.65"
!ll&&!rl&&r
000
MC/DC0%0/2
$CPAN::META->has_usable("File::HomeDir") and "File::HomeDir"->VERSION >= "0.65"
$CPAN::META->has_usable("File::HomeDir") "File::HomeDir"->VERSION >= "0.65"
Truth table0%0/3
A and B
A= $CPAN::META->has_usable("File::HomeDir")B= "File::HomeDir"->VERSION >= "0.65"
ABresult
0X0
100
111
1535 0 File::HomeDir->my_home;
1536 } elsif (defined $ENV{HOME}) {
1537 0 $ENV{HOME};
1538 } else {
1539 0 ▶ (getpwuid $<)[7] || "~";
Condition0%0/2
(getpwuid $<)[7] || '~'
l!l
00
MC/DC0%0/1
(getpwuid $<)[7] || '~'
(getpwuid $<)[7]
Truth table0%0/2
A
A= (getpwuid $<)[7]
Aresult
11
00
1540 }
1541 });
1542 }
1543 }
1544  
1545 7 ▶sub _do_pick_mirrors {
Subroutine _do_pick_mirrors: called CC=8 SCAR=23.2
1546 1 local *_real_prompt;
1547 1 *_real_prompt = \&CPAN::Shell::colorable_makemaker_prompt;
1548 1 $CPAN::Frontend->myprint($prompts{urls_intro});
1549 # Only prompt for auto-pick if Net::Ping is new enough to do timings
1550 1 my $_conf = 'n';
1551 1 ▶ if ( $CPAN::META->has_usable("Net::Ping") && CPAN::Version->vgt(Net::Ping->VERSION, '2.13')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_usable('Net::Ping') and 'CPAN::Version'->vgt('Net::Ping'->VERSION, '2.13')) { } 1 0 1
Condition33%1/3
$CPAN::META->has_usable("Net::Ping") and "CPAN::Version"->vgt("Net::Ping"->VERSION, "2.13")
!ll&&!rl&&r
001
MC/DC0%0/2
$CPAN::META->has_usable("Net::Ping") and "CPAN::Version"->vgt("Net::Ping"->VERSION, "2.13")
$CPAN::META->has_usable("Net::Ping") "CPAN::Version"->vgt("Net::Ping"->VERSION, "2.13")
Truth table33%1/3
A and B
A= $CPAN::META->has_usable("Net::Ping")B= "CPAN::Version"->vgt("Net::Ping"->VERSION, "2.13")
ABresult
0X0
100
111
1552 1 $_conf = prompt($prompts{auto_pick}, "yes");
1553 } else {
1554 0 prompt("Autoselection disabled due to Net::Ping missing or insufficient. Please press ENTER");
1555 }
1556 1 my @old_list = @{ $CPAN::Config->{urllist} };
1557 1 ▶ if ( $_conf =~ /^y/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_conf =~ /^y/i) { } 0 1 1
1558 0 ▶ conf_sites( auto_pick => 1 ) or bring_your_own();
Branch: 1 branch
BranchTrueFalseTotal
conf_sites("auto_pick", 1) or bring_your_own() 0 0 0
1559 }
1560 else {
1561 1 ▶ _print_urllist('Current') if @old_list;
Branch: 1 branch
BranchTrueFalseTotal
if @old_list 1 0 1
1562 1 ▶ my $msg = scalar @old_list
Branch: 1 branch
BranchTrueFalseTotal
scalar @old_list ? : 1 0 1
1563 ? "\nWould you like to edit the urllist or pick new mirrors from a list?"
1564 : "\nWould you like to pick from the CPAN mirror list?" ;
1565 1 my $_conf = prompt($msg, "yes");
1566 1 ▶ if ( $_conf =~ /^y/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_conf =~ /^y/i) 1 0 1
1567 1 conf_sites();
1568 }
1569 1 bring_your_own();
1570 }
1571 1 _print_urllist('New');
1572 }
1573  
1574 4 ▶sub _init_external_progs {
Subroutine _init_external_progs: called CC=29 SCAR=42.2
1575 4 my($matcher,$args) = @_;
1576 4 my $PATH = $args->{path};
1577 4 my @external_progs = @{ $args->{progs} };
1578 4 my $shortcut = $args->{shortcut};
1579 4 my $showed_make_warning;
1580  
1581 4 ▶ if (!$matcher or "@external_progs" =~ /$matcher/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or join($", @external_progs) =~ /$matcher/) 2 2 4
Condition66%2/3
not $matcher or join($", @external_progs) =~ /$matcher/
l!l&&r!l&&!r
202
MC/DC50%1/2
not $matcher or join($", @external_progs) =~ /$matcher/
not $matcher join($", @external_progs) =~ /$matcher/
Truth table66%2/3
not(A) or B
A= not $matcherB= join($", @external_progs) =~ /$matcher/
ABresult
1X1
011
000
1582 2 my $old_warn = $^W;
1583 2 local $^W = $old_warn;
1584 2 my $progname;
1585 2 for $progname (@external_progs) {
1586 10 ▶ next if $matcher && $progname !~ /$matcher/;
Branch: 1 branch
BranchTrueFalseTotal
if $matcher and not $progname =~ /$matcher/ 0 10 10
Condition33%1/3
$matcher and not $progname =~ /$matcher/
!ll&&!rl&&r
1000
MC/DC0%0/2
$matcher and not $progname =~ /$matcher/
$matcher not $progname =~ /$matcher/
Truth table33%1/3
A and not(B)
A= $matcherB= not $progname =~ /$matcher/
ABresult
0X0
100
111
1587  
1588 10 my $progcall = $progname;
1589 10 ▶ unless ($matcher) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($matcher) 10 0 10
1590 # we really don't need ncftp if we have ncftpget, but
1591 # if they chose this dialog via matcher, they shall have it
1592 10 ▶ next if $progname eq "ncftp" && $CPAN::Config->{ncftpget} gt " ";
Branch: 1 branch
BranchTrueFalseTotal
if $progname eq "ncftp" and $CPAN::Config->{"ncftpget"} gt " " 0 10 10
Condition33%1/3
$progname eq "ncftp" and $CPAN::Config->{"ncftpget"} gt " "
!ll&&!rl&&r
1000
MC/DC0%0/2
$progname eq "ncftp" and $CPAN::Config->{"ncftpget"} gt " "
$progname eq "ncftp" $CPAN::Config->{"ncftpget"} gt " "
Truth table33%1/3
A and B
A= $progname eq "ncftp"B= $CPAN::Config->{"ncftpget"} gt " "
ABresult
0X0
100
111
1593 }
1594 my $path = $CPAN::Config->{$progname}
1595 10 ▶ || $Config::Config{$progname}
Condition80%4/5
$CPAN::Config->{$progname} || $Config::Config{$progname} || ''
l!l
28
$CPAN::Config->{$progname} or $Config::Config{$progname}
l!l&&r!l&&!r
028
MC/DC50%1/2
$CPAN::Config->{$progname} || $Config::Config{$progname} || ''
$CPAN::Config->{$progname} $Config::Config{$progname}
Truth table66%2/3
A or B
A= $CPAN::Config->{$progname}B= $Config::Config{$progname}
ABresult
1X1
011
000
1596 || "";
1597 10 ▶ if (File::Spec->file_name_is_absolute($path)) {
Branch: 2 branches
BranchTrueFalseTotal
if ('File::Spec'->file_name_is_absolute($path)) { } 0 10 10
elsif ($path =~ /^\s+$/) { } 0 10 10
1598 # testing existence is not good enough, some have these exe
1599 # extensions
1600  
1601 # warn "Warning: configured $path does not exist\n" unless -e $path;
1602 # $path = "";
1603 } elsif ($path =~ /^\s+$/) {
1604 # preserve disabled programs
1605 } else {
1606 10 $path = '';
1607 }
1608 10 ▶ unless ($path) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($path) 10 0 10
1609 # e.g. make -> nmake
1610 10 ▶ $progcall = $Config::Config{$progname} if $Config::Config{$progname};
Branch: 1 branch
BranchTrueFalseTotal
if $Config::Config{$progname} 2 8 10
1611 }
1612  
1613 10 ▶ $path ||= find_exe($progcall,$PATH);
Condition66%2/3
$path ||= find_exe($progcall, $PATH)
l!l&&r!l&&!r
064
MC/DC50%1/2
$path ||= find_exe($progcall, $PATH)
$path find_exe($progcall, $PATH)
Truth table66%2/3
A ||= B
A= $pathB= find_exe($progcall, $PATH)
ABresult
1X1
011
000
1614 10 ▶ unless ($path) { # not -e $path, because find_exe already checked that
Branch: 1 branch
BranchTrueFalseTotal
unless ($path) 4 6 10
1615 4 local $"=";";
1616 4 ▶ $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH[@$PATH]\n") unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 4 4
1617 4 ▶ _beg_for_make(), $showed_make_warning++ if $progname eq "make";
Branch: 1 branch
BranchTrueFalseTotal
if $progname eq "make" 0 4 4
1618 }
1619 10 $prompts{$progname} = "Where is your $progname program?";
1620 10 $path = my_dflt_prompt($progname,$path,$matcher,1); # 1 => no strip spaces
1621 10 my $disabling = $path =~ m/^\s*$/;
1622  
1623 # don't let them disable or misconfigure make without warning
1624 10 ▶ if ( $progname eq "make" && ( $disabling || ! _check_found($path) ) ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($progname eq 'make' and $disabling || !_check_found($path)) { } 0 10 10
elsif ($disabling) { } 4 6 10
elsif (_check_found($CPAN::Config->{$progname})) { } 6 0 6
Condition50%3/6
$progname eq "make" and $disabling || !_check_found($path)
!ll&&!rl&&r
910
$disabling or not _check_found($path)
l!l&&r!l&&!r
001
MC/DC0%0/3
$progname eq "make" and $disabling || !_check_found($path)
$progname eq "make" $disabling not _check_found($path)
Truth table50%2/4
A and B or not(C)
A= $progname eq "make"B= $disablingC= not _check_found($path)
ABCresult
0XX0
1000
11X1
1011
1625 0 ▶ if ( $disabling && $showed_make_warning ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($disabling and $showed_make_warning) { } 0 0 0
Condition0%0/3
$disabling and $showed_make_warning
!ll&&!rl&&r
000
MC/DC0%0/2
$disabling and $showed_make_warning
$disabling $showed_make_warning
Truth table0%0/3
A and B
A= $disablingB= $showed_make_warning
ABresult
0X0
100
111
1626 0 next;
1627 }
1628 else {
1629 0 ▶ _beg_for_make() unless $showed_make_warning++;
Branch: 1 branch
BranchTrueFalseTotal
unless $showed_make_warning++ 0 0 0
1630 0 undef $CPAN::Config->{$progname};
1631 0 $CPAN::Frontend->mywarn("Press SPACE and ENTER to disable make (NOT RECOMMENDED)\n");
1632 0 redo;
1633 }
1634 }
1635 elsif ( $disabling ) {
1636 4 next;
1637 }
1638 elsif ( _check_found( $CPAN::Config->{$progname} ) ) {
1639 6 ▶ last if $shortcut && !$matcher;
Branch: 1 branch
BranchTrueFalseTotal
if $shortcut and not $matcher 1 5 6
Condition66%2/3
$shortcut and not $matcher
!ll&&!rl&&r
501
MC/DC50%1/2
$shortcut and not $matcher
$shortcut not $matcher
Truth table66%2/3
A and not(B)
A= $shortcutB= not $matcher
ABresult
0X0
100
111
1640 }
1641 else {
1642 0 undef $CPAN::Config->{$progname};
1643 0 $CPAN::Frontend->mywarn("Press SPACE and ENTER to disable $progname\n");
1644 0 redo;
1645 }
1646 }
1647 }
1648 }
1649  
1650 7 ▶sub _check_found {
Subroutine _check_found: called CC=5 SCAR=25.2
1651 7 my ($prog) = @_;
1652 7 ▶ if ( ! -f $prog ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not -f $prog) { } 0 7 7
elsif (not -x $prog) { } 0 7 7
1653 0 ▶ $CPAN::Frontend->mywarn("Warning: '$prog' does not exist\n")
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1654 unless $auto_config;
1655 0 return;
1656 }
1657 elsif ( ! -x $prog ) {
1658 0 ▶ $CPAN::Frontend->mywarn("Warning: '$prog' is not executable\n")
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1659 unless $auto_config;
1660 0 return;
1661 }
1662 7 return 1;
1663 }
1664  
1665 0 ▶sub _beg_for_make {
Subroutine _beg_for_make: not called CC=2 SCAR=17.9
1666 0 $CPAN::Frontend->mywarn(<<"HERE");
1667  
1668 ALERT: 'make' is an essential tool for building perl Modules.
1669 Please make sure you have 'make' (or some equivalent) working.
1670  
1671 HERE
1672 0 ▶ if ($^O eq "MSWin32") {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 0 0
1673 0 $CPAN::Frontend->mywarn(<<"HERE");
1674 Windows users may want to follow this procedure when back in the CPAN shell:
1675  
1676 look YVES/scripts/alien_nmake.pl
1677 perl alien_nmake.pl
1678  
1679 This will install nmake on your system which can be used as a 'make'
1680 substitute.
1681  
1682 HERE
1683 }
1684  
1685 0 $CPAN::Frontend->mywarn(<<"HERE");
1686 You can then retry the 'make' configuration step with
1687  
1688 o conf init make
1689  
1690 HERE
1691 }
1692  
1693 1 ▶sub init_cpan_home {
Subroutine init_cpan_home: called CC=18 SCAR=42.4
Pod undocumented
1694 1 my($matcher) = @_;
1695 1 ▶ if (!$matcher or 'cpan_home' =~ /$matcher/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $matcher or "cpan_home" =~ /$matcher/) 1 0 1
Condition33%1/3
not $matcher or "cpan_home" =~ /$matcher/
l!l&&r!l&&!r
100
MC/DC0%0/2
not $matcher or "cpan_home" =~ /$matcher/
not $matcher "cpan_home" =~ /$matcher/
Truth table33%1/3
not(A) or B
A= not $matcherB= "cpan_home" =~ /$matcher/
ABresult
1X1
011
000
1696 my $cpan_home =
1697 1 ▶ $CPAN::Config->{cpan_home} || CPAN::HandleConfig::cpan_home();
Condition33%1/3
$CPAN::Config->{'cpan_home'} || CPAN::HandleConfig::cpan_home()
l!l&&r!l&&!r
100
MC/DC0%0/2
$CPAN::Config->{'cpan_home'} || CPAN::HandleConfig::cpan_home()
$CPAN::Config->{'cpan_home'} CPAN::HandleConfig::cpan_home()
Truth table33%1/3
A || B
A= $CPAN::Config->{'cpan_home'}B= CPAN::HandleConfig::cpan_home()
ABresult
1X1
011
000
1698 1 ▶ if (-d $cpan_home) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $cpan_home) { } 1 0 1
1699 1 ▶ $CPAN::Frontend->myprint(
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 1 1
1700 "\nI see you already have a directory\n" .
1701 "\n$cpan_home\n" .
1702 "Shall we use it as the general CPAN build and cache directory?\n\n"
1703 ) unless $auto_config;
1704 } else {
1705 # no cpan-home, must prompt and get one
1706 0 ▶ $CPAN::Frontend->myprint($prompts{cpan_home_where}) unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 0 0
1707 }
1708  
1709 1 my $default = $cpan_home;
1710 1 my $loop = 0;
1711 1 my($last_ans,$ans);
1712 1 ▶ $CPAN::Frontend->myprint(" <cpan_home>\n") unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 0 1 1
1713 1 ▶ PROMPT: while ($ans = prompt("CPAN build and cache directory?",$default)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ans = &prompt("CPAN build and cache directory?", $default)) 1 0 1
1714 1 ▶ if (File::Spec->file_name_is_absolute($ans)) {
Branch: 1 branch
BranchTrueFalseTotal
if ('File::Spec'->file_name_is_absolute($ans)) { } 1 0 1
1715 1 my @cpan_home = split /[\/\\]/, $ans;
1716 1 DIR: for my $dir (@cpan_home) {
1717 8 ▶ if ($dir =~ /^~/ and (!$last_ans or $ans ne $last_ans)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dir =~ /^~/ and !$last_ans || $ans ne $last_ans) 0 8 8
Condition16%1/6
$dir =~ /^~/ and !$last_ans || $ans ne $last_ans
!ll&&!rl&&r
800
not $last_ans or $ans ne $last_ans
l!l&&r!l&&!r
000
MC/DC0%0/3
$dir =~ /^~/ and !$last_ans || $ans ne $last_ans
$dir =~ /^~/ not $last_ans $ans ne $last_ans
Truth table25%1/4
A and not(B) or C
A= $dir =~ /^~/B= not $last_ansC= $ans ne $last_ans
ABCresult
0XX0
1000
11X1
1011
1718 0 $CPAN::Frontend
1719 ->mywarn("Warning: a tilde in the path will be ".
1720 "taken as a literal tilde. Please ".
1721 "confirm again if you want to keep it\n");
1722 0 $last_ans = $default = $ans;
1723 0 next PROMPT;
1724 }
1725 }
1726 } else {
1727 0 require Cwd;
1728 0 my $cwd = Cwd::cwd();
1729 0 my $absans = File::Spec->catdir($cwd,$ans);
1730 0 $CPAN::Frontend->mywarn("The path '$ans' is not an ".
1731 "absolute path. Please specify ".
1732 "an absolute path\n");
1733 0 $default = $absans;
1734 0 next PROMPT;
1735 }
1736 1 eval { File::Path::mkpath($ans); }; # dies if it can't
1737 1 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
1738 0 $CPAN::Frontend->mywarn("Couldn't create directory $ans.\n".
1739 "Please retry.\n");
1740 0 next PROMPT;
1741 }
1742 1 ▶ if (-d $ans && -w _) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $ans and -w _) { } 1 0 1
Condition33%1/3
-d $ans and -w _
!ll&&!rl&&r
001
MC/DC0%0/2
-d $ans and -w _
-d $ans -w _
Truth table33%1/3
A and B
A= -d $ansB= -w _
ABresult
0X0
100
111
1743 1 last PROMPT;
1744 } else {
1745 0 $CPAN::Frontend->mywarn("Couldn't find directory $ans\n".
1746 "or directory is not writable. Please retry.\n");
1747 0 ▶ if (++$loop > 5) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$loop > 5) 0 0 0
1748 0 $CPAN::Frontend->mydie("Giving up");
1749 }
1750 }
1751 }
1752 1 $CPAN::Config->{cpan_home} = $ans;
1753 }
1754 }
1755  
1756 45 ▶sub my_dflt_prompt {
Subroutine my_dflt_prompt: called CC=7 SCAR=25.7
Pod undocumented
1757 45 my ($item, $dflt, $m, $no_strip) = @_;
1758 45 ▶ my $default = $CPAN::Config->{$item} || $dflt;
Condition100%3/3
$CPAN::Config->{$item} || $dflt
l!l&&r!l&&!r
161217
MC/DC100%2/2
$CPAN::Config->{$item} || $dflt
$CPAN::Config->{$item} $dflt
Truth table100%3/3
A || B
A= $CPAN::Config->{$item}B= $dflt
ABresult
1X1
011
000
1759  
1760 45 ▶ if (!$auto_config && (!$m || $item =~ /$m/)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/) { } 0 45 45
Condition50%3/6
not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/
!ll&&!rl&&r
33120
not $m or $item =~ /$m/
l!l&&r!l&&!r
0012
MC/DC0%0/3
not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/
not $CPAN::FirstTime::auto_config not $m $item =~ /$m/
Truth table50%2/4
not(A) and not(B) or C
A= not $CPAN::FirstTime::auto_configB= not $mC= $item =~ /$m/
ABCresult
0XX0
1000
11X1
1011
1761 0 ▶ if (my $intro = $prompts{$item . "_intro"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $intro = $CPAN::FirstTime::prompts{$item . '_intro'}) 0 0 0
1762 0 $CPAN::Frontend->myprint($intro);
1763 }
1764 0 $CPAN::Frontend->myprint(" <$item>\n");
1765 $CPAN::Config->{$item} =
1766 $no_strip ? prompt_no_strip($prompts{$item}, $default)
1767 0 ▶ : prompt( $prompts{$item}, $default);
Branch: 1 branch
BranchTrueFalseTotal
$no_strip ? : 0 0 0
1768 } else {
1769 45 $CPAN::Config->{$item} = $default;
1770 }
1771 45 return $CPAN::Config->{$item};
1772 }
1773  
1774 47 ▶sub my_yn_prompt {
Subroutine my_yn_prompt: called CC=8 SCAR=30.1
Pod undocumented
1775 47 my ($item, $dflt, $m) = @_;
1776 47 my $default;
1777 47 ▶ defined($default = $CPAN::Config->{$item}) or $default = $dflt;
Branch: 1 branch
BranchTrueFalseTotal
defined($default = $CPAN::Config->{$item}) or $default = $dflt 18 29 47
1778  
1779 47 ▶ if (!$auto_config && (!$m || $item =~ /$m/)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/) { } 0 47 47
Condition50%3/6
not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/
!ll&&!rl&&r
26210
not $m or $item =~ /$m/
l!l&&r!l&&!r
0021
MC/DC0%0/3
not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/
not $CPAN::FirstTime::auto_config not $m $item =~ /$m/
Truth table50%2/4
not(A) and not(B) or C
A= not $CPAN::FirstTime::auto_configB= not $mC= $item =~ /$m/
ABCresult
0XX0
1000
11X1
1011
1780 0 ▶ if (my $intro = $prompts{$item . "_intro"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $intro = $CPAN::FirstTime::prompts{$item . '_intro'}) 0 0 0
1781 0 $CPAN::Frontend->myprint($intro);
1782 }
1783 0 $CPAN::Frontend->myprint(" <$item>\n");
1784 0 ▶ my $ans = prompt($prompts{$item}, $default ? 'yes' : 'no');
Branch: 1 branch
BranchTrueFalseTotal
$default ? : 0 0 0
1785 0 ▶ $CPAN::Config->{$item} = ($ans =~ /^[y1]/i ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$ans =~ /^[y1]/i ? : 0 0 0
1786 } else {
1787 47 $CPAN::Config->{$item} = $default;
1788 }
1789 }
1790  
1791 21 ▶sub my_prompt_loop {
Subroutine my_prompt_loop: called CC=7 SCAR=19.7
Pod undocumented
1792 21 my ($item, $dflt, $m, $ok) = @_;
1793 21 ▶ my $default = $CPAN::Config->{$item} || $dflt;
Condition66%2/3
$CPAN::Config->{$item} || $dflt
l!l&&r!l&&!r
1470
MC/DC0%0/2
$CPAN::Config->{$item} || $dflt
$CPAN::Config->{$item} $dflt
Truth table66%2/3
A || B
A= $CPAN::Config->{$item}B= $dflt
ABresult
1X1
011
000
1794 21 my $ans;
1795  
1796 21 ▶ if (!$auto_config && (!$m || $item =~ /$m/)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/) { } 1 20 21
Condition83%5/6
not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/
!ll&&!rl&&r
10101
not $m or $item =~ /$m/
l!l&&r!l&&!r
1010
MC/DC66%2/3
not $CPAN::FirstTime::auto_config and !$m || $item =~ /$m/
not $CPAN::FirstTime::auto_config not $m $item =~ /$m/
Truth table75%3/4
not(A) and not(B) or C
A= not $CPAN::FirstTime::auto_configB= not $mC= $item =~ /$m/
ABCresult
0XX0
1000
11X1
1011
1797 1 my $intro = $prompts{$item . "_intro"};
1798 1 ▶ $CPAN::Frontend->myprint($intro) if defined $intro;
Branch: 1 branch
BranchTrueFalseTotal
if defined $intro 0 1 1
1799 1 $CPAN::Frontend->myprint(" <$item>\n");
1800 1 ▶ do { $ans = prompt($prompts{$item}, $default);
Branch: 1 branch
BranchTrueFalseTotal
$ans =~ /$ok/ or do { do { $ans = &prompt($CPAN::FirstTime::prompts{$item}, $default) } } 1 0 1
1801 } until $ans =~ /$ok/;
1802 1 $CPAN::Config->{$item} = $ans;
1803 } else {
1804 20 $CPAN::Config->{$item} = $default;
1805 }
1806 }
1807  
1808  
1809 # Here's the logic about the MIRRORED.BY file. There are a number of scenarios:
1810 # (1) We have a cached MIRRORED.BY file
1811 # (1a) We're auto-picking
1812 # - Refresh it automatically if it's old
1813 # (1b) Otherwise, ask if using cached is ok. If old, default to no.
1814 # - If cached is not ok, get it from the Internet. If it succeeds we use
1815 # the new file. Otherwise, we use the old file.
1816 # (2) We don't have a copy at all
1817 # (2a) If we are allowed to connect, we try to get a new copy. If it succeeds,
1818 # we use it, otherwise, we warn about failure
1819 # (2b) If we aren't allowed to connect,
1820  
1821 1 ▶sub conf_sites {
Subroutine conf_sites: called CC=22 SCAR=50.8
Pod undocumented
1822 1 my %args = @_;
1823 # auto pick implies using the internet
1824 1 ▶ $CPAN::Config->{connect_to_internet_ok} = 1 if $args{auto_pick};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"auto_pick"} 0 1 1
1825  
1826 1 my $m = 'MIRRORED.BY';
1827 1 my $mby = File::Spec->catfile($CPAN::Config->{keep_source_where},$m);
1828 1 File::Path::mkpath(File::Basename::dirname($mby));
1829 # Why are we using MIRRORED.BY from the current directory?
1830 # Is this for testing? -- dagolden, 2009-11-05
1831 1 ▶ if (-f $mby && -f $m && -M $m < -M $mby) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $mby and -f $m and -M $m < -M $mby) 0 1 1
Condition33%2/6
-f $mby and -f $m and -M $m < -M $mby
!ll&&!rl&&r
100
-f $mby and -f $m
!ll&&!rl&&r
010
MC/DC0%0/3
-f $mby and -f $m and -M $m < -M $mby
-f $mby -f $m -M $m < -M $mby
Truth table25%1/4
A and B and C
A= -f $mbyB= -f $mC= -M $m < -M $mby
ABCresult
0XX0
10X0
1100
1111
1832 0 require File::Copy;
1833 0 ▶ File::Copy::copy($m,$mby) or die "Could not update $mby: $!";
Branch: 1 branch
BranchTrueFalseTotal
File::Copy::copy($m, $mby) or die "Could not update ${mby}: $!" 0 0 0
1834 }
1835 1 local $^T = time;
1836 # if we have a cached copy is not older than 60 days, we either
1837 # use it or refresh it or fall back to it if the refresh failed.
1838 1 ▶ if ($mby && -f $mby && -s _ > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mby and -f $mby and -s _ > 0) { } 1 0 1
Condition33%2/6
$mby and -f $mby and -s _ > 0
!ll&&!rl&&r
001
$mby and -f $mby
!ll&&!rl&&r
001
MC/DC0%0/3
$mby and -f $mby and -s _ > 0
$mby -f $mby -s _ > 0
Truth table25%1/4
A and B and C
A= $mbyB= -f $mbyC= -s _ > 0
ABCresult
0XX0
10X0
1100
1111
1839 1 my $very_old = (-M $mby > 60);
1840 1 my $mtime = localtime((stat _)[9]);
1841 # if auto_pick, refresh anything old automatically
1842 1 ▶ if ( $args{auto_pick} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'auto_pick'}) { } 0 1 1
1843 0 ▶ if ( $very_old ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($very_old) 0 0 0
1844 0 $CPAN::Frontend->myprint(qq{Trying to refresh your mirror list\n});
1845 0 ▶ eval { CPAN::FTP->localize($m,$mby,3,1) }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { "CPAN::FTP"->localize($m, $mby, 3, 1) } } or $CPAN::Frontend->myprint("Refresh failed. Using the old cached copy instead.\n") 0 0 0
1846 or $CPAN::Frontend->myprint(qq{Refresh failed. Using the old cached copy instead.\n});
1847 0 $CPAN::Frontend->myprint("\n");
1848 }
1849 }
1850 else {
1851 1 my $prompt = qq{Found a cached mirror list as of $mtime
1852  
1853 If you'd like to just use the cached copy, answer 'yes', below.
1854 If you'd like an updated copy of the mirror list, answer 'no' and
1855 I'll get a fresh one from the Internet.
1856  
1857 Shall I use the cached mirror list?};
1858 1 ▶ my $ans = prompt($prompt, $very_old ? "no" : "yes");
Branch: 1 branch
BranchTrueFalseTotal
$very_old ? : 0 1 1
1859 1 ▶ if ($ans =~ /^n/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ans =~ /^n/i) 0 1 1
1860 0 $CPAN::Frontend->myprint(qq{Trying to refresh your mirror list\n});
1861 # you asked for it from the Internet
1862 0 $CPAN::Config->{connect_to_internet_ok} = 1;
1863 0 ▶ eval { CPAN::FTP->localize($m,$mby,3,1) }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { "CPAN::FTP"->localize($m, $mby, 3, 1) } } or $CPAN::Frontend->myprint("Refresh failed. Using the old cached copy instead.\n") 0 0 0
1864 or $CPAN::Frontend->myprint(qq{Refresh failed. Using the old cached copy instead.\n});
1865 0 $CPAN::Frontend->myprint("\n");
1866 }
1867 }
1868 }
1869 # else there is no cached copy and we must fetch or fail
1870 else {
1871 # If they haven't agree to connect to the internet, ask again
1872 0 ▶ if ( ! $CPAN::Config->{connect_to_internet_ok} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::Config->{"connect_to_internet_ok"}) 0 0 0
1873 0 my $prompt = q{You are missing a copy of the CPAN mirror list.
1874  
1875 May I connect to the Internet to get it?};
1876 0 my $ans = prompt($prompt, "yes");
1877 0 ▶ if ($ans =~ /^y/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ans =~ /^y/i) 0 0 0
1878 0 $CPAN::Config->{connect_to_internet_ok} = 1;
1879 }
1880 }
1881  
1882 # Now get it from the Internet or complain
1883 0 ▶ if ( $CPAN::Config->{connect_to_internet_ok} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{'connect_to_internet_ok'}) { } 0 0 0
1884 0 $CPAN::Frontend->myprint(qq{Trying to fetch a mirror list from the Internet\n});
1885 0 ▶ eval { CPAN::FTP->localize($m,$mby,3,1) }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { "CPAN::FTP"->localize($m, $mby, 3, 1) } } or $CPAN::Frontend->mywarn("We failed to get a copy of the mirror list from the Internet.\nYou will need to provide CPAN mirror URLs yourself.\n") 0 0 0
1886 or $CPAN::Frontend->mywarn(<<'HERE');
1887 We failed to get a copy of the mirror list from the Internet.
1888 You will need to provide CPAN mirror URLs yourself.
1889 HERE
1890 0 $CPAN::Frontend->myprint("\n");
1891 }
1892 else {
1893 0 $CPAN::Frontend->mywarn(<<'HERE');
1894 You will need to provide CPAN mirror URLs yourself or set
1895 'o conf connect_to_internet_ok 1' and try again.
1896 HERE
1897 }
1898 }
1899  
1900 # if we finally have a good local MIRRORED.BY, get on with picking
1901 1 ▶ if (-f $mby && -s _ > 0){
Branch: 1 branch
BranchTrueFalseTotal
if (-f $mby and -s _ > 0) 1 0 1
Condition33%1/3
-f $mby and -s _ > 0
!ll&&!rl&&r
001
MC/DC0%0/2
-f $mby and -s _ > 0
-f $mby -s _ > 0
Truth table33%1/3
A and B
A= -f $mbyB= -s _ > 0
ABresult
0X0
100
111
1902 $CPAN::Config->{urllist} =
1903 1 ▶ $args{auto_pick} ? auto_mirrored_by($mby) : choose_mirrored_by($mby);
Branch: 1 branch
BranchTrueFalseTotal
$args{'auto_pick'} ? : 0 1 1
1904 1 return 1;
1905 }
1906  
1907 0 return;
1908 }
1909  
1910 15 ▶sub find_exe {
Subroutine find_exe: called CC=4 SCAR=13.9
Pod undocumented
1911 15 my($exe,$path) = @_;
1912 15 ▶ $path ||= [split /$Config{'path_sep'}/, $ENV{'PATH'}];
Condition50%1/2
$path ||= [split(/$CPAN::FirstTime::Config{"path_sep"}/, $ENV{"PATH"}, 0)]
l!l
150
MC/DC0%0/1
$path ||= [split(/$CPAN::FirstTime::Config{"path_sep"}/, $ENV{"PATH"}, 0)]
$path
Truth table50%1/2
A
A= $path
Aresult
11
00
1913 15 my($dir);
1914 #warn "in find_exe exe[$exe] path[@$path]";
1915 15 for $dir (@$path) {
1916 132 my $abs = File::Spec->catfile($dir,$exe);
1917 132 ▶ if (($abs = MM->maybe_command($abs))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($abs = "MM"->maybe_command($abs)) 9 123 132
1918 9 return $abs;
1919 }
1920 }
1921 }
1922  
1923 2 ▶sub picklist {
Subroutine picklist: called CC=14 SCAR=32.0
Pod undocumented
1924 2 my($items,$prompt,$default,$require_nonempty,$empty_warning)=@_;
1925 2 ▶ CPAN->debug("picklist('$items','$prompt','$default','$require_nonempty',".
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 2 2
1926 "'$empty_warning')") if $CPAN::DEBUG;
1927 2 ▶ $default ||= '';
Condition50%1/2
$default ||= ""
l!l
20
MC/DC0%0/1
$default ||= ""
$default
Truth table50%1/2
A
A= $default
Aresult
11
00
1928  
1929 2 my $pos = 0;
1930  
1931 2 my @nums;
1932 2 SELECTION: while (1) {
1933  
1934 # display, at most, 15 items at a time
1935 2 my $limit = $#{ $items } - $pos;
1936 2 ▶ $limit = 15 if $limit > 15;
Branch: 1 branch
BranchTrueFalseTotal
if $limit > 15 0 2 2
1937  
1938 # show the next $limit items, get the new position
1939 2 $pos = display_some($items, $limit, $pos, $default);
1940 2 ▶ $pos = 0 if $pos >= @$items;
Branch: 1 branch
BranchTrueFalseTotal
if $pos >= @$items 2 0 2
1941  
1942 2 my $num = prompt($prompt,$default);
1943  
1944 2 @nums = split (' ', $num);
1945 {
1946 2 my %seen;
1947 2 @nums = grep { !$seen{$_}++ } @nums;
1948 }
1949 2 my $i = scalar @$items;
1950 2 unrangify(\@nums);
1951 2 ▶ if (0 == @nums) {
Branch: 2 branches
BranchTrueFalseTotal
if (0 == @nums) { } 0 2 2
elsif (grep((/\D/ || $_ < 1 || $_ > $i), @nums)) { } 0 2 2
1952 # cannot allow nothing because nothing means paging!
1953 # return;
1954 ▶ } elsif (grep (/\D/ || $_ < 1 || $_ > $i, @nums)) {
Condition33%2/6
/\D/ || $_ < 1 || $_ > $i
l!l&&r!l&&!r
003
/\D/ or $_ < 1
l!l&&r!l&&!r
003
MC/DC0%0/3
/\D/ || $_ < 1 || $_ > $i
/\D/ $_ < 1 $_ > $i
Truth table25%1/4
A or B || C
A= /\D/B= $_ < 1C= $_ > $i
ABCresult
1XX1
01X1
0011
0000
1955 0 $CPAN::Frontend->mywarn("invalid items entered, try again\n");
1956 0 ▶ if ("@nums" =~ /\D/) {
Branch: 1 branch
BranchTrueFalseTotal
if (join($", @nums) =~ /\D/) 0 0 0
1957 0 $CPAN::Frontend->mywarn("(we are expecting only numbers between 1 and $i)\n");
1958 }
1959 0 next SELECTION;
1960 }
1961 2 ▶ if ($require_nonempty && !@nums) {
Branch: 1 branch
BranchTrueFalseTotal
if ($require_nonempty and not @nums) 0 2 2
Condition33%1/3
$require_nonempty and not @nums
!ll&&!rl&&r
200
MC/DC0%0/2
$require_nonempty and not @nums
$require_nonempty not @nums
Truth table33%1/3
A and not(B)
A= $require_nonemptyB= not @nums
ABresult
0X0
100
111
1962 0 $CPAN::Frontend->mywarn("$empty_warning\n");
1963 }
1964  
1965 # a blank line continues...
1966 2 ▶ unless (@nums){
Branch: 1 branch
BranchTrueFalseTotal
unless (@nums) 0 2 2
1967 0 $CPAN::Frontend->mysleep(0.1); # prevent hot spinning process on the next bug
1968 0 next SELECTION;
1969 }
1970 2 last;
1971 }
1972 2 for (@nums) { $_-- }
1973 2 @{$items}[@nums];
1974 }
1975  
1976 2 ▶sub unrangify ($) {
Subroutine unrangify: called CC=4 SCAR=14.5
Pod undocumented
1977 2 my($nums) = $_[0];
1978 2 my @nums2 = ();
1979 2 ▶ while (@{$nums||[]}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$nums or [];}) 3 2 5
Condition50%1/2
$nums || []
l!l
50
MC/DC0%0/1
$nums || []
$nums
Truth table50%1/2
A
A= $nums
Aresult
11
00
1980 3 my $n = shift @$nums;
1981 3 ▶ if ($n =~ /^(\d+)-(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n =~ /^(\d+)-(\d+)$/) { } 0 3 3
1982 0 my @range = $1 .. $2;
1983 # warn "range[@range]";
1984 0 push @nums2, @range;
1985 } else {
1986 3 push @nums2, $n;
1987 }
1988 }
1989 2 push @$nums, @nums2;
1990 }
1991  
1992 2 ▶sub display_some {
Subroutine display_some: called CC=5 SCAR=16.6
Pod undocumented
1993 2 my ($items, $limit, $pos, $default) = @_;
1994 2 ▶ $pos ||= 0;
Condition50%1/2
$pos ||= 0
l!l
02
MC/DC0%0/1
$pos ||= 0
$pos
Truth table50%1/2
A
A= $pos
Aresult
11
00
1995  
1996 2 my @displayable = @$items[$pos .. ($pos + $limit)];
1997 2 for my $item (@displayable) {
1998 12 $CPAN::Frontend->myprint(sprintf "(%d) %s\n", ++$pos, $item);
1999 }
2000 2 ▶ my $hit_what = $default ? "SPACE ENTER" : "ENTER";
Branch: 1 branch
BranchTrueFalseTotal
$default ? : 2 0 2
2001 2 ▶ $CPAN::Frontend->myprint(sprintf("%d more items, hit %s to show them\n",
Branch: 1 branch
BranchTrueFalseTotal
if $pos < @$items 0 2 2
2002 (@$items - $pos),
2003 $hit_what,
2004 ))
2005 if $pos < @$items;
2006 2 return $pos;
2007 }
2008  
2009 0 ▶sub auto_mirrored_by {
Subroutine auto_mirrored_by: not called CC=7 SCAR=40.3
Pod undocumented
2010 0 ▶ my $local = shift or return;
Branch: 1 branch
BranchTrueFalseTotal
my $local = shift() or return 0 0 0
2011 0 local $|=1;
2012 0 $CPAN::Frontend->myprint("Looking for CPAN mirrors near you (please be patient)\n");
2013 0 my $mirrors = CPAN::Mirrors->new($local);
2014  
2015 0 my $cnt = 0;
2016 0 my $callback_was_active = 0;
2017 my @best = $mirrors->best_mirrors(
2018 how_many => 3,
2019 0 ▶ callback => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2020 0 $callback_was_active++;
2021 0 $CPAN::Frontend->myprint(".");
2022 0 ▶ if ($cnt++>60) { $cnt=0; $CPAN::Frontend->myprint("\n"); }
Branch: 1 branch
BranchTrueFalseTotal
if ($cnt++ > 60) 0 0 0
2023 },
2024 $CPAN::Config->{urllist_ping_external} ? (external_ping => 1) : (),
2025 0 ▶ $CPAN::Config->{urllist_ping_verbose} ? (verbose => 1) : (),
Branch: 2 branches
BranchTrueFalseTotal
$CPAN::Config->{'urllist_ping_external'} ? : 0 0 0
$CPAN::Config->{'urllist_ping_verbose'} ? : 0 0 0
2026 );
2027  
2028 my $urllist = [
2029 0 map { $_->http }
2030 0 ▶ grep { $_ && ref $_ && $_->can('http') }
Condition0%0/6
$_ && ref $_ && $_->can('http')
!ll&&!rl&&r
000
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/3
$_ && ref $_ && $_->can('http')
$_ ref $_ $_->can('http')
Truth table0%0/4
A and B && C
A= $_B= ref $_C= $_->can('http')
ABCresult
0XX0
10X0
1100
1111
2031 @best
2032 ];
2033 0 push @$urllist, grep { /^file:/ } @{$CPAN::Config->{urllist}};
2034 0 ▶ $CPAN::Frontend->myprint(" done!\n\n") if $callback_was_active;
Branch: 1 branch
BranchTrueFalseTotal
if $callback_was_active 0 0 0
2035  
2036 0 return $urllist
2037 }
2038  
2039 1 ▶sub choose_mirrored_by {
Subroutine choose_mirrored_by: called CC=16 SCAR=36.9
Pod undocumented
2040 1 ▶ my $local = shift or return;
Branch: 1 branch
BranchTrueFalseTotal
my $local = shift() or return 1 0 1
2041 1 my ($default);
2042 1 my $mirrors = CPAN::Mirrors->new($local);
2043 1 my @previous_urls = @{$CPAN::Config->{urllist}};
2044  
2045 1 $CPAN::Frontend->myprint($prompts{urls_picker_intro});
2046  
2047 1 my (@cont, $cont, %cont, @countries, @urls, %seen);
2048 1 my $no_previous_warn =
2049 "Sorry! since you don't have any existing picks, you must make a\n" .
2050 "geographic selection.";
2051 1 my $offer_cont = [sort $mirrors->continents];
2052 1 ▶ if (@previous_urls) {
Branch: 1 branch
BranchTrueFalseTotal
if (@previous_urls) { } 1 0 1
2053 1 push @$offer_cont, "(edit previous picks)";
2054 1 $default = @$offer_cont;
2055 } else {
2056 # cannot allow nothing because nothing means paging!
2057 # push @$offer_cont, "(none of the above)";
2058 }
2059 1 @cont = picklist($offer_cont,
2060 "Select your continent (or several nearby continents)",
2061 $default,
2062 ! @previous_urls,
2063 $no_previous_warn);
2064 # cannot allow nothing because nothing means paging!
2065 # return unless @cont;
2066  
2067 1 foreach $cont (@cont) {
2068 1 my @c = sort $mirrors->countries($cont);
2069 1 @cont{@c} = map ($cont, 0..$#c);
2070 1 ▶ @c = map ("$_ ($cont)", @c) if @cont > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @cont > 1 0 1 1
2071 1 push (@countries, @c);
2072 }
2073 1 ▶ if (@previous_urls && @countries) {
Branch: 1 branch
BranchTrueFalseTotal
if (@previous_urls and @countries) 0 1 1
Condition33%1/3
@previous_urls and @countries
!ll&&!rl&&r
010
MC/DC0%0/2
@previous_urls and @countries
@previous_urls @countries
Truth table33%1/3
A and B
A= @previous_urlsB= @countries
ABresult
0X0
100
111
2074 0 push @countries, "(edit previous picks)";
2075 0 $default = @countries;
2076 }
2077  
2078 1 ▶ if (@countries) {
Branch: 1 branch
BranchTrueFalseTotal
if (@countries) 0 1 1
2079 0 @countries = picklist (\@countries,
2080 "Select your country (or several nearby countries)",
2081 $default,
2082 ! @previous_urls,
2083 $no_previous_warn);
2084 0 %seen = map (($_ => 1), @previous_urls);
2085 # hmmm, should take list of defaults from CPAN::Config->{'urllist'}...
2086 0 foreach my $country (@countries) {
2087 0 ▶ next if $country =~ /edit previous picks/;
Branch: 1 branch
BranchTrueFalseTotal
if $country =~ /edit previous picks/ 0 0 0
2088 0 (my $bare_country = $country) =~ s/ \(.*\)//;
2089 0 my @u;
2090 0 for my $m ( $mirrors->mirrors($bare_country) ) {
2091 0 ▶ push @u, $m->ftp if $m->ftp;
Branch: 1 branch
BranchTrueFalseTotal
if $m->ftp 0 0 0
2092 0 ▶ push @u, $m->http if $m->http;
Branch: 1 branch
BranchTrueFalseTotal
if $m->http 0 0 0
2093 }
2094 0 @u = grep (! $seen{$_}, @u);
2095 0 ▶ @u = map ("$_ ($bare_country)", @u)
Branch: 1 branch
BranchTrueFalseTotal
if @countries > 1 0 0 0
2096 if @countries > 1;
2097 0 push (@urls, sort @u);
2098 }
2099 }
2100 1 push (@urls, map ("$_ (previous pick)", @previous_urls));
2101 1 my $prompt = "Select as many URLs as you like (by number),
2102 put them on one line, separated by blanks, hyphenated ranges allowed
2103 e.g. '1 4 5' or '7 1-4 8'";
2104 1 ▶ if (@previous_urls) {
Branch: 1 branch
BranchTrueFalseTotal
if (@previous_urls) 1 0 1
2105 1 $default = join (' ', ((scalar @urls) - (scalar @previous_urls) + 1) ..
2106 (scalar @urls));
2107 1 $prompt .= "\n(or just hit ENTER to keep your previous picks)";
2108 }
2109  
2110 1 @urls = picklist (\@urls, $prompt, $default);
2111 1 foreach (@urls) { s/ \(.*\)//; }
2112 1 return [ @urls ];
2113 }
2114  
2115 1 ▶sub bring_your_own {
Subroutine bring_your_own: called CC=11 SCAR=35.4
Pod undocumented
2116 1 my $urllist = [ @{$CPAN::Config->{urllist}} ];
2117 1 my %seen = map (($_ => 1), @$urllist);
2118 1 my($ans,@urls);
2119 1 my $eacnt = 0; # empty answers
2120 1 $CPAN::Frontend->myprint(<<'HERE');
2121 Now you can enter your own CPAN URLs by hand. A local CPAN mirror can be
2122 listed using a 'file:' URL like 'file:///path/to/cpan/'
2123  
2124 HERE
2125 1 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$ans || !%seen and do { do { my $prompt = "Enter another URL or ENTER to quit:"; unless (%seen) { $prompt = "CPAN.pm needs at least one URL where it can fetch CPAN files from.\n\nPlease enter your CPAN site:"; } ; $ans = &prompt($prompt, ""); if ($ans) { $ans =~ s[/?\z][/]; $ans = "file:$ans" unless $ans =~ /:/; if ($ans =~ m[^\w+:/.]) { push @urls, $ans unless $seen{$ans}++; } else { $CPAN::Frontend->myprint(sprintf("\"%s\" doesn't look like an URL at first sight.\nI'll ignore it for now.\nYou can add it to your %s\nlater if you're sure it's right.\n", $ans, $INC{"CPAN/MyConfig.pm"} || $INC{"CPAN/Config.pm"} || "configuration file")); } ; } else { if (++$eacnt >= 5) { $CPAN::Frontend->mywarn("Giving up.\n"); $CPAN::Frontend->mysleep(5); return; } ; } } } 0 1 1
Condition33%1/3
$ans or not %seen
l!l&&r!l&&!r
001
MC/DC0%0/2
$ans or not %seen
$ans not %seen
Truth table33%1/3
A or not(B)
A= $ansB= not %seen
ABresult
1X1
011
000
2126 1 my $prompt = "Enter another URL or ENTER to quit:";
2127 1 ▶ unless (%seen) {
Branch: 1 branch
BranchTrueFalseTotal
unless (%seen) 0 1 1
2128 0 $prompt = qq{CPAN.pm needs at least one URL where it can fetch CPAN files from.
2129  
2130 Please enter your CPAN site:};
2131 }
2132 1 $ans = prompt ($prompt, "");
2133  
2134 1 ▶ if ($ans) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ans) { } 0 1 1
2135 0 $ans =~ s|/?\z|/|; # has to end with one slash
2136 # XXX This manipulation is odd. Shouldn't we check that $ans is
2137 # a directory before converting to file:///? And we need /// below,
2138 # too, don't we? -- dagolden, 2009-11-05
2139 0 ▶ $ans = "file:$ans" unless $ans =~ /:/; # without a scheme is a file:
Branch: 1 branch
BranchTrueFalseTotal
unless $ans =~ /:/ 0 0 0
2140 0 ▶ if ($ans =~ /^\w+:\/./) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ans =~ m[^\w+:/.]) { } 0 0 0
2141 0 ▶ push @urls, $ans unless $seen{$ans}++;
Branch: 1 branch
BranchTrueFalseTotal
unless $seen{$ans}++ 0 0 0
2142 } else {
2143 $CPAN::Frontend->
2144 myprint(sprintf(qq{"%s" doesn\'t look like an URL at first sight.
2145 I\'ll ignore it for now.
2146 You can add it to your %s
2147 later if you\'re sure it\'s right.\n},
2148 $ans,
2149 $INC{'CPAN/MyConfig.pm'}
2150 0 ▶ || $INC{'CPAN/Config.pm'}
Condition0%0/5
$INC{'CPAN/MyConfig.pm'} || $INC{'CPAN/Config.pm'} || 'configuration file'
l!l
00
$INC{"CPAN/MyConfig.pm"} or $INC{"CPAN/Config.pm"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$INC{'CPAN/MyConfig.pm'} || $INC{'CPAN/Config.pm'} || 'configuration file'
$INC{"CPAN/MyConfig.pm"} $INC{"CPAN/Config.pm"}
Truth table0%0/3
A or B
A= $INC{"CPAN/MyConfig.pm"}B= $INC{"CPAN/Config.pm"}
ABresult
1X1
011
000
2151 || "configuration file",
2152 ));
2153 }
2154 } else {
2155 1 ▶ if (++$eacnt >= 5) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$eacnt >= 5) 0 1 1
2156 0 $CPAN::Frontend->
2157 mywarn("Giving up.\n");
2158 0 $CPAN::Frontend->mysleep(5);
2159 0 return;
2160 }
2161 }
2162 } while $ans || !%seen;
2163  
2164 1 @$urllist = CPAN::_uniq(@$urllist, @urls);
2165 1 $CPAN::Config->{urllist} = $urllist;
2166 }
2167  
2168 2 ▶sub _print_urllist {
Subroutine _print_urllist: called CC=3 SCAR=11.1
2169 2 my ($which) = @_;
2170 2 $CPAN::Frontend->myprint("$which urllist\n");
2171 2 ▶ for ( @{$CPAN::Config->{urllist} || []} ) {
Condition50%1/2
$CPAN::Config->{'urllist'} || []
l!l
20
MC/DC0%0/1
$CPAN::Config->{'urllist'} || []
$CPAN::Config->{'urllist'}
Truth table50%1/2
A
A= $CPAN::Config->{'urllist'}
Aresult
11
00
2172 6 $CPAN::Frontend->myprint(" $_\n")
2173 };
2174 }
2175  
2176 1 ▶sub _can_write_to_libdirs {
Subroutine _can_write_to_libdirs: called CC=4 SCAR=20.1
2177 return -w $Config{installprivlib}
2178 && -w $Config{installarchlib}
2179 && -w $Config{installsitelib}
2180 && -w $Config{installsitearch}
2181 1 ▶}
Condition33%3/9
-w $CPAN::FirstTime::Config{'installprivlib'} && -w $CPAN::FirstTime::Config{'installarchlib'} && -w $CPAN::FirstTime::Config{'installsitelib'} && -w $CPAN::FirstTime::Config{'installsitearch'}
!ll&&!rl&&r
100
-w $CPAN::FirstTime::Config{"installprivlib"} and -w $CPAN::FirstTime::Config{"installarchlib"} and -w $CPAN::FirstTime::Config{"installsitelib"}
!ll&&!rl&&r
100
-w $CPAN::FirstTime::Config{"installprivlib"} and -w $CPAN::FirstTime::Config{"installarchlib"}
!ll&&!rl&&r
100
MC/DC0%0/4
-w $CPAN::FirstTime::Config{'installprivlib'} && -w $CPAN::FirstTime::Config{'installarchlib'} && -w $CPAN::FirstTime::Config{'installsitelib'} && -w $CPAN::FirstTime::Config{'installsitearch'}
-w $CPAN::FirstTime::Config{"installprivlib"} -w $CPAN::FirstTime::Config{"installarchlib"} -w $CPAN::FirstTime::Config{"installsitelib"} -w $CPAN::FirstTime::Config{'installsitearch'}
Truth table20%1/5
A and B and C && D
A= -w $CPAN::FirstTime::Config{"installprivlib"}B= -w $CPAN::FirstTime::Config{"installarchlib"}C= -w $CPAN::FirstTime::Config{"installsitelib"}D= -w $CPAN::FirstTime::Config{'installsitearch'}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
2182  
2183 1 ▶sub _using_installbase {
Subroutine _using_installbase: called CC=5 SCAR=17.5
2184 1 ▶ return 1 if $ENV{PERL_MM_OPT} && $ENV{PERL_MM_OPT} =~ /install_base/i;
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"PERL_MM_OPT"} and $ENV{"PERL_MM_OPT"} =~ /install_base/i 0 1 1
Condition33%1/3
$ENV{"PERL_MM_OPT"} and $ENV{"PERL_MM_OPT"} =~ /install_base/i
!ll&&!rl&&r
100
MC/DC0%0/2
$ENV{"PERL_MM_OPT"} and $ENV{"PERL_MM_OPT"} =~ /install_base/i
$ENV{"PERL_MM_OPT"} $ENV{"PERL_MM_OPT"} =~ /install_base/i
Truth table33%1/3
A and B
A= $ENV{"PERL_MM_OPT"}B= $ENV{"PERL_MM_OPT"} =~ /install_base/i
ABresult
0X0
100
111
2185 1 ▶ return 1 if grep { ($CPAN::Config->{$_}||q{}) =~ /install_base/i }
Branch: 1 branch
BranchTrueFalseTotal
if grep {($CPAN::Config->{$_} || "") =~ /install_base/i;} "makepl_arg", "make_install_arg", "mbuildpl_arg", "mbuild_install_arg" 0 1 1
Condition100%2/2
$CPAN::Config->{$_} || ''
l!l
22
MC/DC100%1/1
$CPAN::Config->{$_} || ''
$CPAN::Config->{$_}
Truth table100%2/2
A
A= $CPAN::Config->{$_}
Aresult
11
00
2186 qw(makepl_arg make_install_arg mbuildpl_arg mbuild_install_arg);
2187 1 return;
2188 }
2189  
2190 1 ▶sub _using_sudo {
Subroutine _using_sudo: called CC=3 SCAR=11.7
2191 1 ▶ return 1 if grep { ($CPAN::Config->{$_}||q{}) =~ /sudo/ }
Branch: 1 branch
BranchTrueFalseTotal
if grep {($CPAN::Config->{$_} || "") =~ /sudo/;} "make_install_make_command", "mbuild_install_build_command" 0 1 1
Condition50%1/2
$CPAN::Config->{$_} || ''
l!l
20
MC/DC0%0/1
$CPAN::Config->{$_} || ''
$CPAN::Config->{$_}
Truth table50%1/2
A
A= $CPAN::Config->{$_}
Aresult
11
00
2192 qw(make_install_make_command mbuild_install_build_command);
2193 1 return;
2194 }
2195  
2196 9 ▶sub _strip_spaces {
Subroutine _strip_spaces: called CC=1 SCAR=0.0
2197 9 $_[0] =~ s/^\s+//; # no leading spaces
2198 9 $_[0] =~ s/\s+\z//; # no trailing spaces
2199 }
2200  
2201 9 ▶sub prompt ($;$) {
Subroutine prompt: called CC=3 SCAR=11.0
Pod undocumented
2202 9 ▶ unless (defined &_real_prompt) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &CPAN::FirstTime::_real_prompt) 2 7 9
2203 2 *_real_prompt = \&CPAN::Shell::colorable_makemaker_prompt;
2204 }
2205 9 my $ans = _real_prompt(@_);
2206  
2207 9 _strip_spaces($ans);
2208 9 ▶ $CPAN::Frontend->myprint("\n") unless $auto_config;
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::FirstTime::auto_config 8 1 9
2209  
2210 9 return $ans;
2211 }
2212  
2213  
2214 0 ▶sub prompt_no_strip ($;$) {
Subroutine prompt_no_strip: not called CC=2 SCAR=17.9
Pod undocumented
2215 0 ▶ unless (defined &_real_prompt) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &CPAN::FirstTime::_real_prompt) 0 0 0
2216 0 *_real_prompt = \&CPAN::Shell::colorable_makemaker_prompt;
2217 }
2218 0 return _real_prompt(@_);
2219 }
2220  
2221  
2222  
2223 7 1;
« blib/lib/CPAN/Shell.pm ↑ Summary blib/lib/CPAN/Tarzip.pm »