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

Re^2: HTML::Seamstress - the Outsider

by metaperl (Curate)
on Feb 25, 2008 at 20:48 UTC ( #670136=note: print w/replies, xml ) Need Help??

in reply to Re: HTML::Seamstress - the Outsider
in thread RFC - Template::Empty

I've given an example in an above reply. To be specific. The code layer is the perl layer. It is written in perl and is either modules or cgi script. The presentation layer is either a template file or a template string (yes template strings are useful too - so you can put your template in a database for instance). The code layer picks which template to display and gathers data that the presentation layer may need. But then it is up to the presentation layer to lay it out.
What you call a "code layer" sound like a dispatch mechanism... analogous to the controller if we were doing a webapp... but remember dynamic html generation doesnt need cgi/mod_perl at all. So yes, that would be in Perl. And the presentation layer for me, is also 100% pure Perl. And the "template" is a lifeless HTML file, preferably containing some div, class and id tags but nothing more.

Do you see anything suspect with the code I posted?

I have beheld the tarball of 22.1 on with my own eyes. How can you say that there is no God in the Church of Emacs? -- David Kastrup
Enforce strict model-view separation in template engines via HTML::Seamstress The car is in the cdr, not the cdr in the car

Replies are listed 'Best First'.
Re^3: HTML::Seamstress - the Outsider
by Rhandom (Curate) on Feb 25, 2008 at 22:13 UTC
    Do you see anything suspect with the code I posted?
    Absolutely not! Your code is great. Your separation of model/view/controller is textbook quality. Academically, it is sound.

    It just doesn't look like fun. But that is me. It might be to you. I just like that if I can make the "lifeless HTML file" just a little less lifeless, it can greatly simplify my coding load. I can generate data, pass it along and let it be consumed in optimum fashion. But that is "optimal" to me. EMWV (everyone's mileage will vary).

    my @a=qw(random brilliant braindead); print $a[rand(@a)];

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://670136]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2017-12-17 11:24 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (464 votes). Check out past polls.