[Catalyst] NEXT vs SUPER in the catalyst handle_request cycle

Michael Reece mreece at vinq.com
Mon Nov 20 18:13:08 GMT 2006


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?





More information about the Catalyst mailing list