2 # vim: set filetype=perl:
4 # env is a perl script similar in concept to /usr/bin/env
6 # If you have a local-lib5 directory then this script will set it up for
9 # If used like /usr/bin/env then it will run other commands based on
10 # your current path settings (with a local::lib environment if present)
12 # e.g. script/env bash
14 # NOTE: This environment _IS NOT_ self contained
16 # If included inside another perl script, then it will be a no-op if
17 # a local::lib environment is not present, but if one is, it will be
18 # used as a --self-contained environment, expected to contain all non-core
19 # dependencies for your perl
23 # BEGIN { do "$FindBin::Bin/env" or die $@ }
25 # The local::lib behavior can be explicitly enabled or disabled by setting
26 # the CATALYST_LOCAL_LIB enviromnent variable to true or false.
35 if (-r "$FindBin::Bin/Makefile.PL") {
36 $basedir = $FindBin::Bin;
38 elsif (-r "$FindBin::Bin/../Makefile.PL") {
39 $basedir = "$FindBin::Bin/..";
43 my $target = "$basedir/local-lib5";
46 $on = ! ! $ENV{CATALYST_LOCAL_LIB}
47 if (exists $ENV{CATALYST_LOCAL_LIB} and defined $ENV{CATALYST_LOCAL_LIB});
49 Carp::confess("Could not find local-lib5 from '$FindBin::Bin'")
50 if ($on && ! length $basedir);
53 # So we can find local::lib when fully self contained
54 lib->import("$target/lib/perl5");
56 # . for CPAN + app dir
57 my @include = ('.', "$basedir/lib");
59 $ENV{PERL5LIB} = join ':', @include;
62 $ENV{PERL_AUTOINSTALL_PREFER_CPAN}=1;
64 $ENV{PERL_MM_OPT} .= " INSTALLMAN1DIR=none INSTALLMAN3DIR=none";
66 require lib::core::only;
68 lib::core::only->import();
69 local::lib->import( $target );