Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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 ftp.gnu.org with my own eyes. How can you say that there is no God in the Church of Emacs? -- David Kastrup
[tag://html-seamstress]
Enforce strict model-view separation in template engines via HTML::Seamstress The car is in the cdr, not the cdr in the car


Comment on Re^2: HTML::Seamstress - the Outsider
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://670136]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2014-09-02 18:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls