create new tag
, view all tags

Feature Proposal: Fix incorrect way of aborting a plugin invocation


I just spent quite some time (several hours) debugging a problem where a topic was not correctly rendered. I found the following insidious trap lurking in a number of plugins:

Many plugin writers attempt to avoid the overhead of running the handlers where such does not make sense. Thus we find in several plugins code such as this:

    # Only bother with this plugin if viewing (i.e. not searching, etc)
    return unless ($_[0] =~ m/view|viewauth|/o);

The above is from a preRenderingHandler but there are several such examples.

I ran into this when trying to understand why some plugins did not fire correctly when using the GenPDFAddOn, which uses the script genpdf. You can see the problem. Any new script will either have to be tracked in the plugins, or it will not fire.

The plugins need to be careful to rely on the context established in a TWiki session, rather than on the test as to which script is invoking the plugin. If it relies on scripts, it must be at most a negative test, e.g., don't run this handler if such and such script was used.

Description and Documentation

The solution is specific to each plugin.



WhatDoesItAffect: Plugins


Analyze the existing plugins and rewrite these tests. I will do this for my plugins.

-- Contributors: ThomasWeigert - 2010-09-15


Good point.

Idea: How about add a test for each plugin in %FAILEDPLUGINS% so that it is shown InstalledPlugins?

-- PeterThoeny - 2010-09-20

Hmmm.... This test would require a new script that the plugin does not know about and then it would have to somehow determine that the plugin aborted instead of doing its thing. That does not seem easy to do.

-- ThomasWeigert - 2010-09-20

I was more think of calling some plugin handlers with some dummy data and check what the returned value is. That way we could catch an empty return.

-- PeterThoeny - 2010-09-20

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2010-09-20 - 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-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.