[Catalyst] Plugins, Actions, Base Classes - how to modularize controllers
John Napiorkowski
jjn1056 at yahoo.com
Wed Jul 19 15:19:17 CEST 2006
I'll bite,
- a plain vanilla module not in the Catalyst namespace
I'd use this for stuff that is useful in my non Catalyst applications (although there are fewer and fewer of those, mostly crons jobs and admin scripts).
- a base class for the controller
When you are trying to encapsulate some general functionality useful for a particular URI space, such as a Wiki controller I'm working on, or something to handle creating all the header/footer stuff for my basic page on a website.
- a plugin
When making something that can be useful across many actions in your application and in other applications, and if you are modifying the Catalyst processing sequence, like overriding the finalize method.
- an Action
To do pre or post processing/work on particular Catalyst Actions. Useful when a plugin is overkill. I use this for stuff like handling all my validation logic (I hate having to have if(validate) {} else {} over and over again.
My two cents --john
----- Original Message ----
From: Zbigniew Lukasiak <zzbbyy at gmail.com>
To: The elegant MVC web framework <catalyst at lists.rawmode.org>
Sent: Wednesday, July 19, 2006 8:03:15 PM
Subject: [Catalyst] Plugins, Actions, Base Classes - how to modularize controllers
Dear all,
Lets say you have some piece of reusable logic in your controller. You would like to take the logic out and make a module out of it. Then you have following options:
- a plain vanilla module not in the Catalyst namespace
- a base class for the controller
- a plugin
- an Action
The question is which should be chosen when and why.
--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/ _______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060719/08007445/attachment.htm
More information about the Catalyst
mailing list