Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Just a hint on using Roles

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


catalyst at iandocherty

Jul 14, 2009, 1:51 AM

Post #1 of 2 (740 views)
Permalink
Just a hint on using Roles

Hi
I am looking at creating a generic Breadcrumb module to use with
Catalyst. The basic idea being that some controllers will 'reset' a
breadcrumb path back to the start (for example when clicking on a main
menu) and some controllers will append to the existing breadcrumb.

e.g.
Main menu item linking to /users will display a list of all users (reset
breadcrumb)

Clicking on a link on that page to go to /user/123 will append the new
URI to the breadcrumb, /user/123/edit appends again. etc.

I would then be able to create a BreadCrumb Role that could be used with
some of my controllers to maintain a breadcrumb structure on the stash
that could then be used in my templates?

ISTM that this is an ideal application of Roles? I would welcome
comments if this is a sensible approach and I can research the details
further myself.

Regards
Ian


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


publiustemp-catalyst at yahoo

Jul 14, 2009, 3:46 AM

Post #2 of 2 (657 views)
Permalink
Re: Just a hint on using Roles [In reply to]

----- Original Message ----
> From: Ian Docherty <catalyst [at] iandocherty>
>
> Hi
> I am looking at creating a generic Breadcrumb module to use with Catalyst. The
> basic idea being that some controllers will 'reset' a breadcrumb path back to
> the start (for example when clicking on a main menu) and some controllers will
> append to the existing breadcrumb.
>
> e.g.
> Main menu item linking to /users will display a list of all users (reset
> breadcrumb)
>
> Clicking on a link on that page to go to /user/123 will append the new URI to
> the breadcrumb, /user/123/edit appends again. etc.
>
> I would then be able to create a BreadCrumb Role that could be used with some of
> my controllers to maintain a breadcrumb structure on the stash that could then
> be used in my templates?
>
> ISTM that this is an ideal application of Roles? I would welcome comments if
> this is a sensible approach and I can research the details further myself.

Tough to be really certain without seeing the actual app, but yeah, this sounds sensible. Roles are for shared behavior and your reasoning seems solid. Some people, though, argue that roles should not deal with state, only behavior. Thus, delegation would be a preferred option. I've never been entirely convinced by the stateless argument, though.


Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.