Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
In my experience is the MVC approach more an ideal° than a bulletproof method.
BUT ... in this case I'd say it belongs into the View. One rational for MVCs is the possibility to delegate responsibility to domain experts in your team (or to be at least capable to easily scale your team up if necessary) So ask yourself: Whose responsibility is it? IMHO it'll be the decision of the designer of the View how long the visible text is and how it's presented. It's not the domain of the programmer (Controller) nor the DB-Admin (Model) Unfortunately I lack expertise with Template::Toolkit on how best to achieve this ... it has it's own mini language. But I suppose there is more then one way and the Monastery is full of experts. :)
Cheers Rolf °) Shaky Metaphor: A good Christian might attempt to follow the example of Jesus, but not many are ready to die at the cross.
UPDATE> The other way I came up with was to use a callback from the template to the Perl function that splits the text. Again, this seems to tie the logic and display together. I'd keep such Perl code inside a separate file/module named like view_helper.pl with an extra namespace like package View::Helper; See it as an extension of your template framework in the responsibility of your designer. He might delegate change requests to the programmer, if he can't handle Perl, but it's his call.
In reply to Re: Splitting long text for Template (updated)
by LanX
|
|