You are here: Foswiki>Tasks Web>Item9905 (27 Oct 2010, SvenDowideit)Edit Attach

Item9905: EmptyPlugin::_EXAMPLETAG docco is out of date?

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.2
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: SvenDowideit
Waiting For:
Last Change By: SvenDowideit
# The function used to handle the %EXAMPLETAG{...}% macro
# You would have one of these for each macro you want to process.
#sub _EXAMPLETAG {
#    my($session, $params, $theTopic, $theWeb) = @_;
#    # $session  - a reference to the Foswiki session object
#    #             (you probably won't need it, but documented in Foswiki.pm)
#    # $params=  - a reference to a Foswiki::Attrs object containing 
#    #             parameters.
#    #             This can be used as a simple hash that maps parameter names
#    #             to values, with _DEFAULT being the name for the default
#    #             (unnamed) parameter.
#    # $theTopic - name of the topic in the query
#    # $theWeb   - name of the web in the query
#    # Return: the result of processing the macro. This will replace the
#    # macro call in the final text.

-- SvenDowideit - 27 Oct 2010

oh crepe! is this a new thing in 1.1.x?

-- SvenDowideit - 27 Oct 2010

If that is the case the number of broken plugins will be HUGE.

I hope this is a mistake

-- KennethLavrsen - 27 Oct 2010

The signature according to Foswiki::Func's docu is:
sub handler(\%session, \%params, $topic, $web, $topicObject)

We'd never change handlers that dramatically, would we. It would make backwards compatible plugins almost impossible.

As 1.1.x only adds another parameter, everything is fine. This is only a docu error in EmptyPlugin.

-- MichaelDaum - 27 Oct 2010

We'd never change handlers that dramatically, would we - possibly. Perl lets you investigate the type of parameters, so polymorphic signatures are not outside the realms of possibility. However you are correct in that the old signature will always continue to work.

Anyway, Michael is correct. The signature of the internal tag handler functions has changed to eliminate the redundant topic/web parameters, but a registered tag handler is wrapped in an anonymous function that maps the parameters appropriately. See Func::registerTagHandler. The documentation at the top is correct, though incomplete because the $topicObject is now passed as well.

-- CrawfordCurrie - 27 Oct 2010

mmm, and in the process of =git svn dcommit=ing, someone closed my task :), we went through the exact same analysis on irc, only an hour or 2 before you guys woke.

I'm going to sync to 1.1.x branch too - as that'll be around for a while too.

-- SvenDowideit - 27 Oct 2010
 
Topic revision: r9 - 27 Oct 2010, SvenDowideit
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy