[Catalyst] NEXT vs SUPER in the catalyst handle_request cycle

Michael Reece mreece at vinq.com
Mon Nov 20 22:50:32 GMT 2006


i will, but not until the warnings in Catalyst::Plugin::C3 are less  
foreboding.

but let's pretend i am talking about Class::C3 instead; my question  
still stands.

should i just call next::method in all cases, or is it only  
appropriate for certain overrides?  is there an easy way to determine  
when to use one (NEXT or Class::C3) versus the other (SUPER)?

On Nov 20, 2006, at 2:04 PM, J. Shirley wrote:

> Take a look at Class::C3 and next::method, much faster than using NEXT
> and you still get the benefits.
>
> -J
>
> On 11/20/06, Michael Reece <mreece at vinq.com> wrote:
>> i am overriding a handful of catalyst methods so that i can inject
>> some custom debugging/timing code into the request cycle.
>>
>> in MyApp.pm, i have methods
>>
>>         handle_request
>>         prepare
>>         dispatch
>>         forward
>>         finalize
>>
>> that each do their thing and then return $c->NEXT::foo(@_) or $c-
>>  >SUPER::foo(@_), but i am having a difficult time telling when i
>> should use SUPER and when i should use NEXT.
>>
>> recent benchmarks pointing to the slowness of NEXT (plus the
>> annoyances caused by stepping into a NEXT call in the debugger) has
>> led me to use SUPER instead where it seems safe, and trial and error
>> has led to apparently needing NEXT for finalize, while SUPER works
>> for the others, but i am not convinced it is Right.
>>
>> could/should i just call NEXT for all of them?  or is NEXT only
>> appropriate for certain overrides?  is there an easy way to determine
>> when to use one versus the other?
>>
>>
>>
>> _______________________________________________
>> List: Catalyst at lists.rawmode.org
>> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
>> Searchable archive: http://www.mail-archive.com/ 
>> catalyst at lists.rawmode.org/
>> Dev site: http://dev.catalyst.perl.org/
>>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/ 
> catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

---
michael reece :: software engineer :: mreece at vinq.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20061120/4239a130/attachment.htm


More information about the Catalyst mailing list