[Catalyst] NEXT vs SUPER in the catalyst handle_request cycle

Michael Reece mreece at vinq.com
Tue Nov 21 17:15:59 GMT 2006


retracing my steps, i see that NEXT works for all of the methods i  
listed except 'forward'.

sub forward {
     my $c      = shift;
     my $action = shift;
     local $" = ", ";
     my @args = (@_ and ref $_[0] eq 'ARRAY') ? @{ $_[0] } : ();
     $c->timer(2, "Forward to " . (ref($action) || $action) .  
(@args ? "(@args)" : ''));
     return $c->NEXT::forward($action, @_);
}

with that, i get

[debug] "GET" request for "/" from "x.x.x.x"
[debug] Found sessionid "d4a42345c52677ec5e5ded26790e91edd4389287" in  
cookie
[debug] Restored session "d4a42345c52677ec5e5ded26790e91edd4389287"
[info] Request took 0.018640s (53.648/s)
.---------------------------------------------------------------- 
+-----------.
| Action                                                         |  
Time      |
+---------------------------------------------------------------- 
+-----------+
'---------------------------------------------------------------- 
+-----------'

but if i s/NEXT/SUPER/, then it works as expected.

> Then again, I never use the debugger, I'm of the "you can have  
> (printf|warn) when you pry it from my cold, dead fingers" debugging  
> school :)

that it my usual method and works great for in-house code, but  
copying CPAN modules into my personal lib directories so i can fill  
them with warn statements has its own annoyances, so sometimes i  
resort to the debugger using the guidance of  
Catalyst::Manual::Tutorial::Debugging.



On Nov 21, 2006, at 7:21 AM, Matt S Trout wrote:

> Michael Reece wrote:
>> i will, but not until the warnings in Catalyst::Plugin::C3 are  
>> less foreboding.
>
> They're unlikely to get any less foreboding unless people test it  
> and report back - you could at least *try* loading it and provide  
> the results ...
>
>> 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)?
>
> I don't remember the last time I used SUPER.
>
> Then again, I never use the debugger, I'm of the "you can have  
> (printf|warn) when you pry it from my cold, dead fingers" debugging  
> school :)
>
> _______________________________________________
> 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/20061121/fbc74337/attachment.htm


More information about the Catalyst mailing list