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

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


On Tue, Dec 13, 2005 at 04:40:52PM -0800, apv wrote:
> On Tuesday, December 13, 2005, at 04:34  PM, Matt S Trout wrote:
> >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 rather agree in part but it's information that is going into the DB 
> as opposed
> to--directly, anyway--the screen. So, the data (html) should be 
> transformed before
> it ever gets sent to TT. I don't want to reprocess it every time. I 
> think. I
> can see advantages to that because it would be the same format to the
> user. But then I think you end up running into legacy issues when making
> changes down the road, having to support things you wish you could just
> flush. But it's definitely something to think about.

Have a look at Class::MethodFilter, a small module I wrote ages back for
pretty much this use case (in a long-abandoned web forum engine I was writing)

-- 
     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