Beefy Boxes and Bandwidth Generously Provided by pair Networks
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
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) 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
in thread Splitting long text for Template by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found