create new tag
, view all tags

Add a Plugin Identifier Function

In a discussion started at SmartSessionPluginDev about identifying one version of SessionPlugin over another version of SessionPlugin, it seemed like it would be nice for there to be some function within the Func core that would return information about any particular plugin to any user of that function. This would allow other plugins to quickly know what plugins were installed AND what versions of those plugins were installed. Based on that version information, they could integrate with those other plugins more easily.

The function, something like identifierPluginInformation could return a hash which had at LEAST one key, namely VERSION. If no identifierPluginInformationHandler was found within each plugin, then the VERSION key would be populated with the VERSION within each plugin. If an identifierPluginInformationHandler was found, that Handler could populate not only VERSION, but add other keys to the hash. This would allow plugins to return custom information to the caller.

If a plugin was not found (or it did not have a VERSION nor an identifierPluginInforamtionHandler), this function could return undef implying that the plugin was not installed or could not be queried for information.

This would allow plugins like TigerSkinPlugin and GnuSkinPlugin to figure out if SessionPlugin was installed, and if it was, if it was the SmartSessionPlugin version or the SessionPlugin version. Based on simply the version information, the output of the skin plugins could be programmatically different.

This would not be a difficult function to implement. Is there any interest for it?

-- TedPavlic - 25 Aug 2003

Note that an object-oriented plugin scheme would take care of this intrinsically.

-- TedPavlic - 25 Aug 2003

In the meantime, it is possible to get at the VERSION information of a Plugin directly through $TWiki::Plugins::PluginName::VERSION.

Something like:

if( defined( $TWiki::Plugins::PluginName::VERSION ) )
    if( $TWiki::Plugins::PluginName::VERSION >= 2.000 )
        # This is Version 2 of the Plugin; Use V2 features
        # This is a previous version of the plugin

Other information could be exported this way too. The hash to which I referred could be accessed in this way.

I'd hate to start a precedent of exporting information this way. This "takes advantage" of the already existing "OO-ness" of the plugin modules just like someone would "take advantage" of his best friend's sister who is in an existing state of depression over the loss of her brother. In other words, it's dirty, and should only be done if it represents the only girl at the party...

-- TedPavlic - 25 Aug 2003

I think this is already covered by contexts.

-- RafaelAlvarez - 13 Aug 2008

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2008-08-13 - RafaelAlvarez
  • 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.