diff -r 000000000000 -r 414e01d06fd5 bin/setlib.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/setlib.cfg Sat Jan 26 15:50:53 2008 +0100 @@ -0,0 +1,59 @@ +# +# TWiki Collaboration Platform, http://TWiki.org/ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. For +# more details read LICENSE in the root of this distribution. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# setlib.cfg: determines the defaults for TWiki and Perl library paths +# + +########################################################################### +# DO NOT CHANGE THIS FILE - instead, create a file called LocalLib.cfg # +# using the LocalLib.cfg.txt template file and customise your settings in # +# there. They will override any settings in this file. # +########################################################################### + +# for development, you can enable ASSERTS by adding +# $ENV{TWIKI_ASSERTS} = 1; +# to your bin/LocalLib.cfg + +use vars qw( $twikiLibPath @localPerlLibPath ); + +eval 'require "LocalLib.cfg"'; + +unless (( defined ($twikiLibPath) ) and (-e $twikiLibPath)) { + use Cwd qw( abs_path ); + ( $twikiLibPath ) = ($twikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/; +} +if ($twikiLibPath eq "") { + $twikiLibPath = "../lib"; + warn "using relative path for libs - some plugins may break"; +} + +# Path to local Perl modules +my $defaultingCPANBASE = !defined($CPANBASE); +$CPANBASE = "$twikiLibPath/CPAN/lib/" unless $CPANBASE; +if ( -e $CPANBASE ) { + require Config; + my $VER = $Config::Config{version}; + my $SITEARCH = $Config::Config{archname}; + push @localPerlLibPath, ( "$CPANBASE/arch", "$CPANBASE/$VER/$SITEARCH", "$CPANBASE/$VER", "$CPANBASE" ); +} + +# Prepend to @INC, the Perl search path for modules +unshift @INC, $twikiLibPath; +if ($defaultingCPANBASE) { + push @INC, @localPerlLibPath if defined @localPerlLibPath; +} else { + unshift @INC, @localPerlLibPath if defined @localPerlLibPath; +} + +1; # Return success for module loading +