Re: lib/RT/Ticket.pm introspection callback for Kanban 4.2.12 rt-extension-kanban
Christian Loos <[email protected]> Wed, 2 Mar 2016 15:15:39 +0100
| Newsgroups | gmane.comp.bug-tracking.request-tracker.devel |
|---|---|
| Message-ID | <[email protected]> |
You can't overwrite parts of a method in Perl, you can only overwrite the whole method. But you actually don't want to override a method, you want to call a custom method, or additional code, inside an existing function. When you overwrite the RT::Ticket Create method and then call inside this the original Create method, the Create method from the installed RT is called. So if you install your extension in RT 4.2.0, the 4.2.0 version of the Create method is called, if you install your extension in RT 4.2.12, the 4.2.12 version of the Create method is called. With this solution you can provide your extension for a wider range of RT version. Have you looked at the example link from my previous mail? They overwrite there the RT::Interface::Email->ExtractTicketId method, and call the original method inside this on line 114. Chris Am 02.03.2016 um 14:41 schrieb Joachim Schiele: > i understand this like that: > complete functions can be overriden like this but not single sections of > a function as in a patch. > > if my understanding is correct, then the method you proposed would > require us to supply 3 Ticket.pm functions for each individual rt > release as these implementations might change over time. > > correct? > > On 02.03.2016 14:19, Christian Loos wrote: >> > Hi Joachim, >> > >> > actually this isn't necessary. >> > You can overwrite the Create method and call inside your Create method >> > the original Create method. >> > >> > Have a look at this: >> > https://github.com/bestpractical/rt-extension-repliestoresolved/blob/master/lib/RT/Extension/RepliesToResolved.pm#L102-L146 --------- RT 4.4 and RTIR Training Sessions (http://bestpractical.com/services/training.html) * Hamburg Germany - March 14 & 15, 2016 * Washington DC - May 23 & 24, 2016