[Catalyst] New built in action!
Sebastian Riedel
sri at oook.de
Sat Oct 22 16:58:55 CEST 2005
Am 22.10.2005 um 16:07 schrieb Bill Moseley:
> On Sat, Oct 22, 2005 at 01:42:12PM +0200, Sebastian Riedel wrote:
>
>> We (mostly Matt) just finished the new dispatcher, so we were able to
>> implement a new feature many of you requested.
>>
>> The "index" action! :)
>>
>
> So in a App::C::Admin::Users, a controller for dealing with Users:
>
> sub index : Private {
> [show a list of users]
> }
>
> And then this request shows a list of users.
>
> /admin/users
>
>
>> This action is much like "default" but doesn't take arguments and is
>> weighted a bit higher.
>> So the new order is "normal action", "index", "default".
>>
>
> Doesn't take arguments in that you can't do:
>
> sub index : Private {
> my ($self, $c, @args ) = @_;
> }
>
> You can do that with default, but @args is the full path from root,
> regardless of which controller default is in.
>
>
> So if it doesn't take a list of arguments does that mean:
>
> /admin/users/12
>
> can't be then used show user number 12?
>
> And if later I defined in:
>
> package App::C::Admin;
>
> sub users : Local {}
>
> that will then override App::C::Admin::Users::index?
>
> It's still pre-coffee time for me, but how is index different from how
> default works?
You try to use it like default, but it's completely different.
It's not meant for interactivity, it's a entry point for a
controller, "index" *hint hint*. :)
We hope it will simplify the logic in current "default" actions.
--
sebastian
More information about the Catalyst
mailing list