Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
it was rhandomly stated:
but now we've made the code layer manipulate the presentation layer. I think this is worse than having control flow in the template. I've found that Template::Toolkit syntax and particularly Template::Alloy (which I authored) if used properly are the perfect separation between model and view. And it is the perfect separation from both directions.
If you would like to come up with an empirical measure of "perfect" or give examples which show how Alloy is better than Seamstress, I will be more than happy to provide fully working Seamstress counterparts.

You chief expressed concern is:

but now we've made the code layer manipulate the presentation layer.
I dont know what a "code layer" is... please tell me what a code layer is, preferably with an example showing how horrible it makes the seamstress experience.

for me, dynamic html consists of:

accessing the model and storing it in an iterator or in-memory data structure

my $records = Data::Object->load(welcome_data => $cookie->user) ;

accessing the view and storing in a seamstress object (a subclass of HTML::Tree)

my $tree = html::welcome->new;

executing presentation logic

$tree->replace_content(user_name => $records->[0]{user_name});
That is clear, clean and simple and allows maximum independence of HTML developer and Perl programmer... I have zero need to touch the HTML. and complete ability to swap model loading and presentation logic using any of a number of object oriented techniques...
I have beheld the tarball of 22.1 on ftp.gnu.org with my own eyes. How can you say that there is no God in the Church of Emacs? -- David Kastrup
[tag://oop,html,templating]
Enforce strict model-view separation in template engines via HTML::Seamstress The car is in the cdr, not the cdr in the car

In reply to object-oriented composition of model-view with HTML::Seamstress by metaperl
in thread RFC - Template::Empty by redhotpenguin

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 sharing their wisdom with the Monastery: (8)
As of 2024-04-19 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found