[Catalyst] To plugin or not to plugin; style/best-practices

Matt S Trout dbix-class at trout.me.uk
Wed Dec 14 01:34:06 CET 2005


On Tue, Dec 13, 2005 at 04:10:52PM -0800, apv wrote:
> I'm working on a user supplied comment. I want to apply some auto 
> formatting to it (paras but with somewhat complicated rules for where 
> they go, no simple splitting on "\n\n," so it's not going to be very 
> compact code) in addition to HTML sanitizing.
> 
> Should this be a plugin or a controller? If a plugin makes sense, is 
> there one already out there I should look at for good learning code?

Sounds like view logic to me :)

I'd suggest building it as a Template Toolkit filter, assuming that's
what you're using for the rendering - have a look at the appropriate bits
of Template::Manual::Directives and ::Config and the Template::Context
API for details.

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list