use Carp ();
use Config;
-our $VERSION = '1.004007'; # 1.4.7
+our $VERSION = '1.005001'; # 1.5.1
my @KNOWN_FLAGS = (qw/--self-contained/);
sub import {
DEATH
# Remember what PERL5LIB was when we started
- my $perl5lib = $ENV{PERL5LIB};
+ my $perl5lib = $ENV{PERL5LIB} || '';
my %arg_store;
for my $arg (@args) {
PERL5LIB => join($Config{path_sep},
$class->install_base_perl_path($path),
$class->install_base_arch_path($path),
- ($ENV{PERL5LIB} ?
+ (($ENV{PERL5LIB}||()) ?
($interpolate == INTERPOLATE_ENV
? ($ENV{PERL5LIB})
: (($^O ne 'MSWin32') ? '$PERL5LIB' : '%PERL5LIB%' ))
PATH => join($Config{path_sep},
$class->install_base_bin_path($path),
($interpolate == INTERPOLATE_ENV
- ? $ENV{PATH}
+ ? ($ENV{PATH}||())
: (($^O ne 'MSWin32') ? '$PATH' : '%PATH%' ))
),
)
From the shell -
- # Install LWP and it's missing dependencies to the 'my_lwp' directory
+ # Install LWP and its missing dependencies to the 'my_lwp' directory
perl -MCPAN -Mlocal::lib=my_lwp -e 'CPAN::install(LWP)'
# Install LWP and *all non-core* dependencies to the 'my_lwp' directory
echo 'eval $(perl -I$HOME/foo/lib/perl5 -Mlocal::lib=$HOME/foo)' >>~/.bashrc
+After writing your shell configuration file, be sure to re-read it to get the
+changed settings into your current shell's environment. Bourne shells use C<.
+~/.bashrc> for this, whereas C shells use C<source ~/.cshrc>. Replace .bashrc or
+.cshrc with the name of the file you wrote above with the echo command.
+
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,
+If you want to install multiple Perl module environments, say for application development,
install local::lib globally and then:
cd ~/mydir1
These values are then available for reference by any code after import.
+=head1 CREATING A SELF-CONTAINED SET OF MODULES
+
+You can use local::lib to prepare a directory which contains a module and all
+of its non-core dependencies. The C<--self-contained> option ignores any
+globally installed modules when resolving dependencies, only considering
+modules installed in a "local::lib" directory or provided by core Perl.
+
+A use-case for this feature would be to prepare to deploy a whole "stack" of
+module dependencies on a new machine, even if you have copies of the same
+dependencies installed globally already.
+
+The C<--self-contained> option should be used like this:
+
+ # Install LWP and *all non-core* dependencies to the 'my_lwp' directory
+ perl -MCPAN -Mlocal::lib=--self-contained,my_lwp -e 'CPAN::install(LWP)'
+
+Note that some dependencies may involve C-based "XS" code even if your target
+module doesn't. The issue of dealing with XS vs Pure Perl code is beyond the scope
+of what local::lib provides.
+
=head1 METHODS
=head2 ensure_directory_structure_for
Patch to add Win32 support contributed by Curtis Jewell <csjewell@cpan.org>.
+Warnings for missing PATH/PERL5LIB (as when not running interactively) silenced
+by a patch from Marco Emilio Poleggi.
+
+=head1 COPYRIGHT
+
+Copyright (c) 2007 - 2009 the local::lib L</AUTHOR> and L</CONTRIBUTORS> as
+listed above.
+
=head1 LICENSE
-This library is free software under the same license as perl itself.
+This library is free software and may be distributed under the same terms
+as perl itself.
=cut