Tags:
create new tag
view all tags
The Plugins runtime environment should be well-defined and stable. However I have found that the environment is rather odd and seems to change between runs of a plugin. Specifically, the current working directory is sometimes set to the home directory of the logged in user (maybe by another plugin, or by a search?). This is not a problem unless you try to "require" a piece of code into your module using a relative path - and unfortunately, the first thing on the path is the relative path ../lib.

Reqiuring code into you plugin usually done in the interests of efficiency, but it is also required for the CairoCompatabilityModule which should only be required when running with Beijing or earlier.

The workarounds are to require from within a BEGIN block, to force evaluation during compilation e.g:

BEGIN {
  if ( $TWiki::Plugins::VERSION < 1.020 ) {
   require TWiki::Plugins::CairoCompatibilityModule;
  }
};
which of course requires fervent prayer that no plugin Cwd's during init. Better is to use an unpublished TWiki function:
if ( $TWiki::Plugins::VERSION < 1.020 ) {
  push(TWiki::getTWikiLibDir(), @INC);
  require TWiki::Plugins::CairoCompatibilityModule;
}
It would be much much better if TWiki guaranteed the runtime environment for plugins. Failing that, at least guarantee the include path. Failing that, functions to get all key directories (lib, bin, templates) could be published via the FuncDotPm interface.

-- CrawfordCurrie - 21 May 2004

Not sure if this qualifies as a bug. The notes in setlib.cfg state:

#    Path to lib directory containing TWiki.pm.
#    ATTENTION: Set to absolute file path:
$twikiLibPath = '../lib';

I updated TWikiInstallationGuide accordingly.

-- PeterThoeny - 30 May 2004

However the fact that most twiki deployments run without changing this to an absolute path means that most people will not do so. So the plugin authors' problem of not being sure of the actual current working directory remains.

-- MattWilkie - 30 May 2004

I set this to resolved since it is documented to set the lib path to an absolute value.

-- PeterThoeny - 11 Jul 2004

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2004-07-11 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.