📄 config.pm
字号:
=item skiptestA boolean indicating whether or not to skip tests when installing modules.Defaults to 'false'.=cut $Conf->{'conf'}->{'skiptest'} = 0;=item storableA boolean indicating whether or not to use C<Storable> to write compiledsource file information to disk. This makes for faster startup and lookup times, but takes extra diskspace. Defaults to 'true' if you have C<Storable> installed and 'false' if you don't.=cut $Conf->{'conf'}->{'storable'} = ( check_install( module => 'Storable' ) ? 1 : 0 );=item timeoutDigit indicating the time before a fetch request times out (in seconds).Defaults to 300.=cut $Conf->{'conf'}->{'timeout'} = 300;=item verboseA boolean indicating whether or not C<CPANPLUS> runs in verbose mode.Defaults to 'true' if you have the environment variable C<PERL5_CPANPLUS_VERBOSE> set to true, 'false' otherwise.It is recommended you run with verbose enabled, but it is disabledfor historical reasons.=cut $Conf->{'conf'}->{'verbose'} = $ENV{PERL5_CPANPLUS_VERBOSE} || 0;=item write_install_logA boolean indicating whether or not to write install logs after installinga module using the interactive shell. Defaults to 'true'.=cut $Conf->{'conf'}->{'write_install_logs'} = 1;=back =head2 Section 'program'=cut ### Paths get stripped of whitespace on win32 in the constructor ### sudo gets emptied if there's no need for it in the constructor=over 4=item editorA string holding the path to your editor of choice. Defaults to your$ENV{EDITOR}, $ENV{VISIUAL}, 'vi' or 'pico' programs, in that order.=cut $Conf->{'program'}->{'editor'} = do { $ENV{'EDITOR'} || $ENV{'VISUAL'} || can_run('vi') || can_run('pico') };=item makeA string holding the path to your C<make> binary. Looks for the C<make>program used to build perl or failing that, a C<make> in your path.=cut $Conf->{'program'}->{'make'} = can_run($Config{'make'}) || can_run('make');=item pagerA string holding the path to your pager of choice. Defaults to your$ENV{PAGER}, 'less' or 'more' programs, in that order.=cut $Conf->{'program'}->{'pager'} = $ENV{'PAGER'} || can_run('less') || can_run('more'); ### no one uses this feature anyway, and it's only working for EU::MM ### and not for module::build #'perl' => '',=item shellA string holding the path to your login shell of choice. Defaults to your$ENV{SHELL} setting, or $ENV{COMSPEC} on Windows.=cut $Conf->{'program'}->{'shell'} = $^O eq 'MSWin32' ? $ENV{COMSPEC} : $ENV{SHELL};=item sudoA string holding the path to your C<sudo> binary if your install pathrequires super user permissions. Looks for C<sudo> in your path, or remains empty if you do not require super user permissiosn to install.=cut $Conf->{'program'}->{'sudo'} = do { ### let's assume you dont need sudo, ### unless one of the below criteria tells us otherwise my $sudo = undef; ### you're a normal user, you might need sudo if( $> ) { ### check for all install dirs! ### installsiteman3dir is a 5.8'ism.. don't check ### it on 5.6.x... ### you have write permissions to the installdir, ### you don't need sudo if( -w $Config{'installsitelib'} && ( defined $Config{'installsiteman3dir'} && -w $Config{'installsiteman3dir'} ) && -w $Config{'installsitebin'} ) { $sudo = undef; ### you have PERL_MM_OPT set to some alternate ### install place. You probably have write permissions ### to that } elsif ( $ENV{'PERL_MM_OPT'} and $ENV{'PERL_MM_OPT'} =~ /INSTALL|LIB|PREFIX/ ) { $sudo = undef; ### you probably don't have write permissions } else { $sudo = can_run('sudo'); } } ### and return the value $sudo; };=item perlwrapperA string holding the path to the C<cpanp-run-perl> utility bundledwith CPANPLUS, which is used to enable autoflushing in spawned processes.=cut ### perlwrapper that allows us to turn on autoflushing $Conf->{'program'}->{'perlwrapper'} = sub { my $name = 'cpanp-run-perl'; my @bins = do{ require Config; my $ver = $Config::Config{version}; ### if we are running with 'versiononly' enabled, ### all binaries will have the perlversion appended ### ie, cpanp will become cpanp5.9.5 ### so prefer the versioned binary in that case $Config::Config{versiononly} ? ($name.$ver, $name) : ($name, $name.$ver); }; ### patch from Steve Hay Fri 29 Jun 2007 14:26:02 GMT+02:00 ### Msg-Id: <4684FA5A.7030506@uk.radan.com> ### look for files with a ".bat" extension as well on Win32 @bins = map { $_, "$_.bat" } @bins if $^O eq 'MSWin32'; my $path; BIN: for my $bin (@bins) { ### parallel to your cpanp/cpanp-boxed my $maybe = File::Spec->rel2abs( File::Spec->catfile( dirname($0), $bin ) ); $path = $maybe and last BIN if -f $maybe; ### parallel to your CPANPLUS.pm: ### $INC{cpanplus}/../bin/cpanp-run-perl $maybe = File::Spec->rel2abs( File::Spec->catfile( dirname($INC{'CPANPLUS.pm'}), '..', # lib dir 'bin', # bin dir $bin, # script ) ); $path = $maybe and last BIN if -f $maybe; ### you installed CPANPLUS in a custom prefix, ### so go paralel to /that/. PREFIX=/tmp/cp ### would put cpanp-run-perl in /tmp/cp/bin and ### CPANPLUS.pm in ### /tmp/cp/lib/perl5/site_perl/5.8.8 $maybe = File::Spec->rel2abs( File::Spec->catfile( dirname( $INC{'CPANPLUS.pm'} ), '..', '..', '..', '..', # 4x updir 'bin', # bin dir $bin, # script ) ); $path = $maybe and last BIN if -f $maybe; ### in your path -- take this one last, the ### previous two assume extracted tarballs ### or user installs ### note that we don't use 'can_run' as it's ### not an executable, just a wrapper... ### prefer anything that's found in the path paralel to your $^X for my $dir (File::Spec->rel2abs( dirname($^X) ), split(/\Q$Config::Config{path_sep}\E/, $ENV{PATH}), File::Spec->curdir, ) { ### On VMS the path could be in UNIX format, and we ### currently need it to be in VMS format $dir = VMS::Filespec::vmspath($dir) if ON_VMS; $maybe = File::Spec->catfile( $dir, $bin ); $path = $maybe and last BIN if -f $maybe; } } ### we should have a $path by now ideally, if so return it return $path if defined $path; ### if not, warn about it and give sensible default. ### XXX try to be a no-op instead then.. ### cross your fingers... ### pass '-P' to perl: "run program through C ### preprocessor before compilation" ### XXX using -P actually changes the way some Makefile.PLs ### are executed, so don't do that... --kane error(loc( "Could not find the '%1' binary in your path". "--this may be a problem.\n". "Please locate this program and set ". "your '%2' config entry to its path.\n". "From the default shell, you can do this by typing:\n\n". " %3\n". " %4\n", $name, 'perlwrapper', 's program perlwrapper FULL_PATH_TO_CPANP_RUN_PERL', 's save' )); return ''; }->(); =back=cutsub new { my $class = shift; my $obj = $class->SUPER::new; $obj->mk_accessors( keys %$Conf ); for my $acc ( keys %$Conf ) { my $subobj = Object::Accessor->new; $subobj->mk_accessors( keys %{$Conf->{$acc}} ); ### read in all the settings from the sub accessors; for my $subacc ( $subobj->ls_accessors ) { $subobj->$subacc( $Conf->{$acc}->{$subacc} ); } ### now store it in the parent object $obj->$acc( $subobj ); } $obj->_clean_up_paths; ### shut up IPC::Cmd warning about not findin IPC::Run on win32 $IPC::Cmd::WARN = 0; return $obj;}sub _clean_up_paths { my $self = shift; ### clean up paths if we are on win32 if( $^O eq 'MSWin32' ) { for my $pgm ( $self->program->ls_accessors ) { my $path = $self->program->$pgm; ### paths with whitespace needs to be shortened ### for shell outs. if ($path and $path =~ /\s+/) { my($prog, $args); ### patch from Steve Hay, 13nd of June 2007 ### msg-id: <467012A4.6060705@uk.radan.com> ### windows directories are not allowed to end with ### a space, so any occurrence of '\w\s+/\w+' means ### we're dealing with arguments, not directory ### names. if ($path =~ /^(.*?)(\s+\/.*$)/) { ($prog, $args) = ($1, $2); ### otherwise, there are no arguments } else { ($prog, $args) = ($path, ''); } $prog = Win32::GetShortPathName( $prog ); $self->program->$pgm( $prog . $args ); } } } return 1;}1;=pod=head1 BUG REPORTSPlease report bugs or other issues to E<lt>bug-cpanplus@rt.cpan.org<gt>.=head1 AUTHORThis module by Jos Boumans E<lt>kane@cpan.orgE<gt>.=head1 COPYRIGHTThe CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans E<lt>kane@cpan.orgE<gt>. All rights reserved.This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.=head1 SEE ALSOL<CPANPLUS::Backend>, L<CPANPLUS::Configure::Setup>, L<CPANPLUS::Configure>=cut# Local variables:# c-indentation-style: bsd# c-basic-offset: 4# indent-tabs-mode: nil# End:# vim: expandtab shiftwidth=4:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -