1lib::core::only(3) User Contributed Perl Documentation lib::core::only(3)
2
3
4
6 lib::core::only - Remove all non-core paths from @INC to avoid
7 site/vendor dirs
8
10 use lib::core::only; # now @INC contains only the two core directories
11
12 To get only the core directories plus the ones for the local::lib in
13 scope:
14
15 $ perl -Mlib::core::only -Mlocal::lib=~/perl5 myscript.pl
16
17 To attempt to do a self-contained build (but note this will not
18 reliably propagate into subprocesses, see the CAVEATS below):
19
20 $ PERL5OPT='-Mlib::core::only -Mlocal::lib=~/perl5' cpan
21
23 lib::core::only is simply a shortcut to say "please reduce my @INC to
24 only the core lib and archlib (architecture-specific lib) directories
25 of this perl".
26
27 You might want to do this to ensure a local::lib contains only the code
28 you need, or to test an App::FatPacker tree, or to avoid known bad
29 vendor packages.
30
31 You might want to use this to try and install a self-contained tree of
32 perl modules. Be warned that that probably won't work (see "CAVEATS").
33
34 This module was extracted from local::lib's --self-contained feature,
35 and contains the only part that ever worked. I apologise to anybody who
36 thought anything else did.
37
39 This does not propagate properly across perl invocations like
40 local::lib's stuff does. It can't. It's only a module import, so it
41 only affects the specific perl VM instance in which you load and
42 import() it.
43
44 If you want to cascade it across invocations, you can set the PERL5OPT
45 environment variable to '-Mlib::core::only' and it'll sort of work. But
46 be aware that taint mode ignores this, so some modules' build and test
47 code probably will as well.
48
49 You also need to be aware that perl's command line options are not
50 processed in order - -I options take effect before -M options, so
51
52 perl -Mlib::core::only -Ilib
53
54 is unlike to do what you want - it's exactly equivalent to:
55
56 perl -Mlib::core::only
57
58 If you want to combine a core-only @INC with additional paths, you need
59 to add the additional paths using -M options and the lib module:
60
61 perl -Mlib::core::only -Mlib=lib
62
63 # or if you're trying to test compiled code:
64
65 perl -Mlib::core::only -Mblib
66
67 For more information on the impossibility of sanely propagating this
68 across module builds without help from the build program, see
69 <http://www.shadowcat.co.uk/blog/matt-s-trout/tainted-love> - and for
70 ways to achieve the old --self-contained feature's results, look at
71 App::FatPacker's tree function, and at App::cpanminus's
72 --local-lib-contained feature.
73
75 Matt S. Trout <mst@shadowcat.co.uk>
76
78 This library is free software under the same terms as perl itself.
79
81 (c) 2010 the lib::core::only "AUTHOR" as specified above.
82
83
84
85perl v5.16.3 2013-02-12 lib::core::only(3)