We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
Tags:
create new tag
, view all tags
CPAN installs into multiple directories, not into a single one. See CpanPerlModulesRequirement for how to install CPAN modules. This means that it needs PERL5LIB to include all of them. $localPerlLibPath in setlib.cfg is thus wrong to be a scalar - it needs to take an array.

-- MartinCleaver - 09 May 2004

A sensible enhancement.

-- PeterThoeny - 09 May 2004

martin, this latest version of the patch is much better. i've updated it to use $Config{version} instead of %v (turns out the version number type is being deprecated), and, more importantly, to base localPerlLibPath on $twikiLibPath. the idea is that $twikiLib/CPAN is a sensible default (it's certainly better than some made up path which is guaranteed not to work) which can be editted just any other example default value; this default value can be useful — $twikiLib/CPAN seems like a sensible place to install local CPAN modules, too.

-- WillNorris - 30 Sep 2004

Seems that this would slow down every module load in every TWiki installation, just to help those who need to install CPAN modules in their local path - so it would be better if this was a conditional, or ideally commented out, as with the original code.

The Config.pm module is loaded by some paths in the code (in SVNget:lib/TWiki.cfg), but not all, so this could be a significant overhead.

-- RichardDonkin - 27 Oct 2004

thanks for the feedback, richard. i've tried to address your concerns, but i'd also like to make the code more autoconfiguring. posted below is another attempt.

-- WillNorris - 08 Nov 2004


Index: setlib.cfg
===================================================================
--- setlib.cfg   (revision 1820)
+++ setlib.cfg   (working copy)
@@ -34,21 +34,26 @@
+#    Path to local Perl modules
+my $CPANBASE = "$twikiLibPath/CPAN/lib/site_perl";
+if ( -e $CPANBASE )
+{
+   require Config;
+   my $VER = $Config::Config{version};
+   my $SITEARCH = $Config::Config{archname};
+   @localPerlLibPath = ( "$CPANBASE/$VER/$SITEARCH/", "$CPANBASE/$VER/", "$CPANBASE/" );
+}
 
-#    Path to local Perl modules (e.g. under home directory for users
-#    without 'root' on Unix/Linux). Uncomment and set if needed:
-# $localPerlLibPath = '';
 
-
 # -------------- Don't change anything below this line
 
 # Prepend to @INC, the Perl search path for modules
 unshift @INC, $twikiLibPath;
-unshift @INC, $localPerlLibPath if $localPerlLibPath;
+unshift @INC, @localPerlLibPath if defined @localPerlLibPath;
 
 1;                # Return success for module loading

checked into DEVELOP r3351

-- WillNorris - 06 Dec 2004

Just saw this checkin and commented on twiki-dev - the use of Config is also an extra overhead.

it's not extra "overhead" unless it's needed; it does a require rather than a use.

-- WillNorris - 08 Dec 2004

The extra code should either be commented out (using suitable POD commands) or perhaps put in a setlib-full.cfg module that can be used by anyone who wants the extra path elements.

RichardDonkin suggestion of commenting using POD was implemented and checked in by CrawfordCurrie in DEVELOP r3360

-- RafaelAlvarez - 07 Dec 2004

Suggestion: How about generating this file from an installer script? I realise people want to unzip and go, but such a script could also edit the script shebang lines and it would move some of this overhead to install time, and make it possible to only pay the overhead on sites that want it.

-- RichardDonkin - 07 Dec 2004

i am interested in continued improvement in the installer. i think it would be wise to revist all of the configuration and setup files, rather than doing it piecemeal. however, i'm not prepared to do that at this time, but i should be soon. i'll be back with more details and comments when that happens.

i've separated out comments regarding the cwd usage to DefaultTWikiLibDirectory. Other comments added inline.

-- WillNorris - 08 Dec 2004

a comprehensive evaluation of the configuration files has started on TWikiDotCfgNeedsGardening

-- WillNorris - 27 Jan 2005

LocalLib.cfg allows total flexibility in for DakarRelease, so I'm closing the topic.

-- CrawfordCurrie - 28 Mar 2005

moved the CPAN directories calculations to the sample bin/LocalLib.cfg.txt

-- WillNorris - 27 Apr 2005

 
Topic revision: r24 - 27 Apr 2005 - 12:57:16 - WillNorris
Codev.SetMultipleDirsInSetlibDotCfg moved from Codev.SetlibDotCfg on 09 May 2004 - 08:59 by PeterThoeny - put it back
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback