[Catalyst] Very basic chained question

Santiago Zarate santiago at zarate.net.ve
Wed Jan 18 04:10:38 GMT 2012


Hello, if i'm not mistaken, you could just do:

sub base :PathPart('/member/profile') CaptureArgs(0) { ... }

sub edit :PathPart('edit') Chained('base') CaptureArgs(0) { ... }

sub image :PathPart('image') Chained('edit') CaptureArgs(0) { ... }

That should do it, there's a very easy to understand doc at the
catalyst's wiki [1]

[1]http://wiki.catalystframework.org/wiki/gettingstarted/howtos/chainedexamples

On Tue, Jan 17, 2012 at 10:56 PM, Fagyal Csongor
<concept at conceptonline.hu> wrote:
> Hi,
>
> Sorry about this basic question, but I am kind of lost when it comes to
> chained dispatching.
>
> I have a controller "Members::Profile" with methods "edit" and "images".
>
> I would like "edit" called with the URL "/members/profile/edit", and
> "images" and *after that* "edit" called with "/members/profile/edit/images".
>
> I thought this should look something like as:
> sub edit: Local Args(0) { ... }
> sub images: PathPart('images') Chained('edit') { ... }
>
> But obviously I misunderstand something.
>
> I have also tried:
> sub edit :PathPart('edit') Chained('') CaptureArgs(0) { ... }
> sub images :PathPart('images') Chained('edit') Args(0) { ... }
>
> I guess this clearly shows I just have no idea how this is supposed to work
> :)
>
> It actually works if I add another method like this:
> sub edit :PathPart('members/profile/edit') Chained('/') CaptureArgs(0) { ...
> }
> sub images :PathPart('images') Chained('edit') Args(0) { ... }
> sub root : PathPart('') Chained('edit') Args(0) { ... }
>
> This kind of looks logical, but it don't think this is what I should do: I
> don't like the PathPart for edit, and the extra method either.
>
>
> So how do I do this properly?
>
> Thanks,
> - Fagzal
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



-- 
Santiago Zarate
Consultoria de Software || Software Consulting
  +(507) 64271684
  Skype: santiago-ve
  BB PIN: 23929BFE
  santiago at zarate.net.ve

"La mejor forma de hacer que un adolecente lea un libro es vetandolo.
Cuando alguien que ostenta una figura de autoridad dice, 'Danos tu
libro', creo que esos estudiantes piensan 'Debe haber algo poderoso en
esas palabras'." - Erin Gruwell

"The best way to get a teenager to read a book is to ban it. When
someone who is a daunting authority figure says, 'Give us your book',
I think these students [thought], 'There must be something powerful in
these words'. " - Erin Gruwell



More information about the Catalyst mailing list