colas@0
|
1 |
#
|
colas@0
|
2 |
# TWiki Collaboration Platform, http://TWiki.org/
|
colas@0
|
3 |
#
|
colas@0
|
4 |
# This program is free software; you can redistribute it and/or
|
colas@0
|
5 |
# modify it under the terms of the GNU General Public License
|
colas@0
|
6 |
# as published by the Free Software Foundation; either version 2
|
colas@0
|
7 |
# of the License, or (at your option) any later version. For
|
colas@0
|
8 |
# more details read LICENSE in the root of this distribution.
|
colas@0
|
9 |
#
|
colas@0
|
10 |
# This program is distributed in the hope that it will be useful,
|
colas@0
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
colas@0
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
colas@0
|
13 |
#
|
colas@0
|
14 |
# setlib.cfg: determines the defaults for TWiki and Perl library paths
|
colas@0
|
15 |
#
|
colas@0
|
16 |
|
colas@0
|
17 |
###########################################################################
|
colas@0
|
18 |
# DO NOT CHANGE THIS FILE - instead, create a file called LocalLib.cfg #
|
colas@0
|
19 |
# using the LocalLib.cfg.txt template file and customise your settings in #
|
colas@0
|
20 |
# there. They will override any settings in this file. #
|
colas@0
|
21 |
###########################################################################
|
colas@0
|
22 |
|
colas@0
|
23 |
# for development, you can enable ASSERTS by adding
|
colas@0
|
24 |
# $ENV{TWIKI_ASSERTS} = 1;
|
colas@0
|
25 |
# to your bin/LocalLib.cfg
|
colas@0
|
26 |
|
colas@0
|
27 |
use vars qw( $twikiLibPath @localPerlLibPath );
|
colas@0
|
28 |
|
colas@0
|
29 |
eval 'require "LocalLib.cfg"';
|
colas@0
|
30 |
|
colas@0
|
31 |
unless (( defined ($twikiLibPath) ) and (-e $twikiLibPath)) {
|
colas@0
|
32 |
use Cwd qw( abs_path );
|
colas@0
|
33 |
( $twikiLibPath ) = ($twikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/;
|
colas@0
|
34 |
}
|
colas@0
|
35 |
if ($twikiLibPath eq "") {
|
colas@0
|
36 |
$twikiLibPath = "../lib";
|
colas@0
|
37 |
warn "using relative path for libs - some plugins may break";
|
colas@0
|
38 |
}
|
colas@0
|
39 |
|
colas@0
|
40 |
# Path to local Perl modules
|
colas@0
|
41 |
my $defaultingCPANBASE = !defined($CPANBASE);
|
colas@0
|
42 |
$CPANBASE = "$twikiLibPath/CPAN/lib/" unless $CPANBASE;
|
colas@0
|
43 |
if ( -e $CPANBASE ) {
|
colas@0
|
44 |
require Config;
|
colas@0
|
45 |
my $VER = $Config::Config{version};
|
colas@0
|
46 |
my $SITEARCH = $Config::Config{archname};
|
colas@0
|
47 |
push @localPerlLibPath, ( "$CPANBASE/arch", "$CPANBASE/$VER/$SITEARCH", "$CPANBASE/$VER", "$CPANBASE" );
|
colas@0
|
48 |
}
|
colas@0
|
49 |
|
colas@0
|
50 |
# Prepend to @INC, the Perl search path for modules
|
colas@0
|
51 |
unshift @INC, $twikiLibPath;
|
colas@0
|
52 |
if ($defaultingCPANBASE) {
|
colas@0
|
53 |
push @INC, @localPerlLibPath if defined @localPerlLibPath;
|
colas@0
|
54 |
} else {
|
colas@0
|
55 |
unshift @INC, @localPerlLibPath if defined @localPerlLibPath;
|
colas@0
|
56 |
}
|
colas@0
|
57 |
|
colas@0
|
58 |
1; # Return success for module loading
|
colas@0
|
59 |
|