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
}
else
{
# 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
CategoryPluginsAPI