[Bast-commits] r6028 - in local-lib/1.000/trunk: . lib/local

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Wed Apr 29 20:28:10 GMT 2009


Author: t0m
Date: 2009-04-29 21:28:10 +0100 (Wed, 29 Apr 2009)
New Revision: 6028

Modified:
   local-lib/1.000/trunk/Changes
   local-lib/1.000/trunk/lib/local/lib.pm
Log:
doc patch from amiri in #catalyst

Modified: local-lib/1.000/trunk/Changes
===================================================================
--- local-lib/1.000/trunk/Changes	2009-04-29 19:09:34 UTC (rev 6027)
+++ local-lib/1.000/trunk/Changes	2009-04-29 20:28:10 UTC (rev 6028)
@@ -1,5 +1,8 @@
 Revision history for local::lib
 
+       - Additional documentation and examples concerning having multiple
+         local::lib enviornments (amiri)
+
 1.003003 2009-04-09
         - Expose the internals per RT #36846.
         - Fix the MANIFEST up a bit.

Modified: local-lib/1.000/trunk/lib/local/lib.pm
===================================================================
--- local-lib/1.000/trunk/lib/local/lib.pm	2009-04-29 19:09:34 UTC (rev 6027)
+++ local-lib/1.000/trunk/lib/local/lib.pm	2009-04-29 20:28:10 UTC (rev 6028)
@@ -368,6 +368,32 @@
 
   $ echo 'eval $(perl -I$HOME/foo/lib/perl5 -Mlocal::lib=$HOME/foo)' >>~/.bashrc
 
+If you want to install multiple Perl module environments, say for application evelopment, 
+install local::lib globally and then:
+
+    $ cd ~/mydir1
+    $ perl -Mlocal::lib=./
+    $ eval $(perl -Mlocal::lib=./)  ### To set the environment for this shell alone
+    $ printenv  ### You will see that ~/mydir1 is in the PERL5LIB
+    $ perl -MCPAN -e install ...    ### whatever modules you want
+    $ cd ../mydir2
+    ... REPEAT ...
+
+For multiple environments for multiple apps you may need to include a modified version of 
+the C<< use FindBin >> instructions in the "In code" sample above. If you did something like
+the above, you have a set of Perl modules at C<< ~/mydir1/lib >>. If you have a script at
+C<< ~/mydir1/scripts/myscript.pl >>, you need to tell it where to find the modules you installed 
+for it at C<< ~/mydir1/lib>>. 
+
+In C<< ~/mydir1/scripts/myscript.pl >>:
+
+    use strict;
+    use warnings;
+    use local::lib "$FindBin::Bin/..";  ### points to ~/mydir1 and local::lib finds lib
+    use lib "$FindBin::Bin/../lib";     ### points to ~/mydir1/lib
+
+Put this before any BEGIN { ... } blocks that require the modules you installed.
+
 =head1 DESCRIPTION
 
 This module provides a quick, convenient way of bootstrapping a user-local Perl




More information about the Bast-commits mailing list