use warnings;
use File::Spec;
use Cwd;
-use vars qw($bootstrapping $bootstrapping_args);
+use vars qw($bootstrapping $bootstrapping_args $no_manpages);
use Config;
my $cwd;
if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) {
@ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV;
$bootstrapping = 1;
+ if(my ($x) = grep { /^--no-manpages/ } @ARGV) {
+ $no_manpages = 1;
+ @ARGV = grep { !/^--no-manpages/ } @ARGV;
+ }
my ($path) = $x =~ /^--bootstrap(?:=(.*))?$/;
my @args = $path ? $path : ();
if ($cpan) {
system($^X, '-MCPAN', '-e', 'CPAN::Config->load; CPAN::Config->commit;');
}
+ if($no_manpages) {
+ # if we call this code directly, the changes get written to
+ # $BOOTSTRAP/lib/perl5/CPAN/Config.pm, not where the user expects them to
+ # be in their ~/.cpan/CPAN/MyConfig.pm.
+ system($^X, '-MCPAN',
+ '-e',
+ q[CPAN::HandleConfig->load;],
+ '-e',
+ q[$CPAN::Config->{makepl_arg} = ] .
+ q['INSTALLMAN1DIR=none INSTALLMAN3DIR=none';],
+ '-e',
+ q[$CPAN::Config->{buildpl_arg} = ] .
+ q['--install_path libdoc="" --install_path bindoc=""';],
+ '-e',
+ q[CPAN::Config->commit;],
+ );
+ }
chdir($cwd);
}
use Carp ();
use Config;
-our $VERSION = '1.004004'; # 1.4.4
+our $VERSION = '1.004006'; # 1.4.6
+my @KNOWN_FLAGS = (qw/--self-contained/);
sub import {
my ($class, @args) = @_;
+ @args <= 1 + @KNOWN_FLAGS or die <<'DEATH';
+Please see `perldoc local::lib` for directions on using this module.
+DEATH
# Remember what PERL5LIB was when we started
my $perl5lib = $ENV{PERL5LIB};
- # The path is required, but last in the list, so we pop, not shift here.
- my $path = pop @args;
- $path = $class->resolve_path($path);
- $class->setup_local_lib_for($path);
-
- # Handle the '--self-contained' option
- my $flag = shift @args;
- no warnings 'uninitialized'; # the flag is optional
- # make sure fancy dashes cause an error
- if ($flag =~ /−/) {
+ my %arg_store;
+ for my $arg (@args) {
+ # check for lethal dash first to stop processing before causing problems
+ if ($arg =~ /−/) {
die <<'DEATH';
WHOA THERE! It looks like you've got some fancy dashes in your commandline!
These are *not* the traditional -- dashes that software recognizes. You
terminal, but can happen elsewhere too. Please try again after replacing the
dashes with normal minus signs.
DEATH
+ }
+ elsif(grep { $arg eq $_ } @KNOWN_FLAGS) {
+ (my $flag = $arg) =~ s/--//;
+ $arg_store{$flag} = 1;
+ }
+ elsif($arg =~ /^--/) {
+ die "Unknown import argument: $arg";
+ }
+ else {
+ # assume that what's left is a path
+ $arg_store{path} = $arg;
+ }
}
- if ($flag eq '--self-contained') {
- # The only directories that remain are those that we just defined and those where core modules are stored.
- # We put PERL5LIB first, so it'll be favored over privlibexp and archlibexp
+
+ if($arg_store{'self-contained'}) {
+ # The only directories that remain are those that we just defined and those
+ # where core modules are stored. We put PERL5LIB first, so it'll be favored
+ # over privlibexp and archlibexp
my %seen;
@INC = grep { ! $seen{$_}++ } (
- $class->install_base_perl_path($path),
- $class->install_base_arch_path($path),
+ $class->install_base_perl_path($arg_store{path}),
+ $class->install_base_arch_path($arg_store{path}),
split( $Config{path_sep}, $perl5lib ),
$Config::Config{privlibexp},
$Config::Config{archlibexp}
# @INC from growing with each invocation
$ENV{PERL5LIB} = join( $Config{path_sep}, @INC );
}
- elsif (defined $flag) {
- die "unrecognized import argument: $flag";
- }
+
+ $arg_store{path} = $class->resolve_path($arg_store{path});
+ $class->setup_local_lib_for($arg_store{path});
for (@INC) { # Untaint @INC
next if ref; # Skip entry if it is an ARRAY, CODE, blessed, etc.
$ echo 'eval $(perl -I$HOME/foo/lib/perl5 -Mlocal::lib=$HOME/foo)' >>~/.bashrc
+If you're on a slower machine, or are operating under draconian disk space
+limitations, you can disable the automatic generation of manpages from POD when
+installing modules by using the C<--no-manpages> argument when bootstrapping:
+
+ $ perl Makefile.PL --bootstrap --no-manpages
+
If you want to install multiple Perl module environments, say for application evelopment,
install local::lib globally and then:
'--self-contained' feature contributed by Mark Stosberg <mark@summersault.com>.
+Ability to pass '--self-contained' without a directory inspired by frew on
+irc.perl.org/#catalyst.
+
Doc patches for a custom local::lib directory contributed by Torsten Raudssus
<torsten@raudssus.de>.