[Catalyst] default : Local v. default : Path

Paul Makepeace paulm at paulm.com
Tue Jul 7 07:15:27 GMT 2009


On Mon, Jul 6, 2009 at 1:51 PM, Tomas Doran<bobtfish at bobtfish.net> wrote:
>
> On 6 Jul 2009, at 18:14, Paul Makepeace wrote:
>
>> We just upgraded from 5.80005 to 5.80007 and default : Local is no longer
>> matching $controller/ (i.e. requires $controller/default)
>>
>> I was curious what the difference is, and flagging it for anyone else.
>
> Yes, sorry about that - it's a regression / correctness fix. 5.80005
> considered anything called 'default' to be a default method, no matter what
> attributes you have it - which was a huge pile of fail..
>
> The incorrect behavior was:
>
> sub default : Chained('/') PathPart('foobarbaz') Args(0) => became
> /mycontrollernamespace/.*
>
> The correct behavior is:
>
> sub default : Local => asking for mycontrollernamespace/default
>
> sub default : Private => asking to be last-case fallback for
> mycontrollernamespace/.*

My app recently started failing with default : Private. IIRC at YAPC10
mst said this was a  relic of bygone Catalyst days.

So what does "default : Path" actually _mean_? The docs say,

"Path actions match things starting with a precise specified path, and
nothing else." and "Empty Path definitions match on the namespace
only, exactly like :Global."

My reading of that is that :Path means *any* sub (not just default)
would match /$controller - is that right?

> This is somewhat a regression on 5.7, and somewhat a fix - as we now
> correctly handle priorities in all cases with default / Path actions,
> allowing the most specific action to match in all cases.
>
>> FWIW, IMO,
>> http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Intro.pod#Built-in_special_actions
>> is a slightly odd place to be documenting in reference style the actions. Is
>> there another place? This is one of those things I keep expecting has a home
>> and then eventually finding back in the Manual's intro.
>
> I totally agree. Please nominate where it should be (where did you look
> hardest that it wasn't), and we'll put it there instead, with the
> clarifications to the expected behavior you're about to make if it isn't
> crystal as-is.. :)

I'll have a think and get back to you after my Vegas fuzz has cleared.

Thanks for the clear explanations!

Paul



More information about the Catalyst mailing list