Yep. We are now comparing apples
and organges.
Please allow me to start over. Here is what i am passionate
about: seeing someone use HERE DOCS to create their own
half-baked "templating system" for the generation of HTML
documents (i never said anything about LaTeX).
Why am i passionate about that? Because i have extensively
used HTML::Template and Template with great success, being
able to finish on time, and being left with a very, very
extensible and easily modifiable system. I am also passionate about it because i have used and seen other
technologies that allow you to paint yourself into the
corner a few months down the road. The reason i spoke up
against your original HERE DOC code is that you cannot convince me that storing HTML inside some Perl code is
better than storing HTML inside it's own .html text file.
Sure i have to load it into memory ... but this is WEB
PROGRAMMING!!! That time is so negligable, but then again,
i am not producing LaTeX (and i will probably never have
to).
Now then, i am not arguing that HERE DOCS are bad
and should be deprecated, i just don't need them. If
HTML::Template and/or Template (or HTML::Mason, Apache::ASP,
CGI.pm) used HERE DOCS under the hood ... i would
still use them! Again, my argument really is not about the
technology that was chosen, but the failure to use an
existing solution from
CPAN.
So, if i have a need to create LaTeX, then i will most
definitely look at Text::Vpp ... and i
wholeheartedly thank you for introducing me to it. But ...
i do HTML and plain old text.
Now then, a small rebutal:
"...From my experience as programmer: you really have messed up your design. What you planed to achieve - separation of code and data - for better maintainability,reusability etc. gets lost."
Well, exactly what have you done with
HTML::Template? Until you "figure it out", you will most
certainly lose your goal of content/data separation. The
tool itself only lends you a hand to successful,
maintainable, and reusable seperation. It's up to
YOU to see that those goals are achieved. Speaking
from my own experience, i failed many times, still stuck in
my ways of thinking that certain bits of HTML still needed
to be generated from the code. Once i learned what
content/data seperation really means, my templates and code
started to reflect it.
Now then, when i said i do this for a living, i was
talking about Web Application Development ... HTML. For the
record, anyone who does that for a living is a fool if they
think that HTML::Template and Template are just "nifty
tools" - they are quickly becoming necessary tools.
Even PHP (which i still use where appriopriate), a
templating tool in itself, offers at least two templating
tools: Smarty and a
PHP HTML::Template.
I am sorry, but your words are still those of someone who
has not used these tools enough to give valid critisms ...
yet! I want more proof, and not just your opinion. (And i
should note that i am very skeptical about people
who still use UPPER CASE letters in their HTML tags -
that's a big "still stuck in the stone age" flag.)
And finally, for the record - i do not dislike HERE DOCS.
I just shouldn't have to use them directly or have
to scan through them to find what i have to change. God
forbid that a web developer had to do the same ... and no,
CSS won't always prevent that from happening! I consider
HERE DOCS to be a quick and dirty tool for those quick and
dirty moments when i need some quick and dirty results. But,
tell me ... what advantage does using a HERE DOC have over
my $header = qq|<html>
<head>
<title>$title</title>
</head>
|;
and how do you achieve conditional branches and loops with
HERE DOCS? (And yes ... i know that Text::Vpp provides
this.) You build them yourself. That is what i was arguing against, and the fact that you just admitted you use an existing CPAN module to "manage" your HERE DOCS only
strengthens the spirit of my argument:
USE THE CPAN! ;)
But, for text (that includes HTML) ... i will continue to
use HTML::Template or Template, simply because each HTML
document gets to live where it should: inside an HTML
document.
|