[rt-devel] lib/RT/Ticket.pm introspection callback for Kanban 4.2.12 rt-extension-kanban

Joachim Schiele js at lastlog.de
Wed Mar 2 09:39:19 EST 2016


On 02.03.2016 15:15, Christian Loos wrote:
> 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.

of course we were looking at the provided code but at first we didn't
understand what it meant to us. we also had to analyze, if calling the
comoplete implementation and then do something with the IDs would work
for us, but we are now confident it probably will.

thanks so much for your help! this is actually 'exactly' what we wanted.

we will now experiment with the implementation details!

> 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
>


-- 
Joachim Schiele

blog: http://blog.lastlog.de
wiki: http://lastlog.de
jabber: josh at jabber.ccc.de
GPG: C6AC8770





More information about the rt-devel mailing list