[Catalyst] New built in action!

Bill Moseley moseley at hank.org
Sat Oct 22 17:07:39 CEST 2005


On Sat, Oct 22, 2005 at 04:58:55PM +0200, Sebastian Riedel wrote:
> >    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*. :)

Trying to be efficient in language, do you mean "index" as in the way
Apache shows an "index" of a directory?

Then isn't that just like this?

> >    sub index : Private {
> >        [show a list of users]
> >    }
> >
> >And then this request shows a list of users.
> >
> >    /admin/users

It's would seem natural to show one use to do this then:

    /admin/users/12


Just like:

    http://host/path/to/directory/

shows an index, and then selecting one of the items from that list
does:

    http//host/path/to/directory/item


-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list