Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] What is this technique called?

Expand Messages
  • merlyn@stonehenge.com
    ... essential Hello Everyone: essential I use this technique all the time to write HTML: essential print ....your HTML code here.....
    Message 1 of 2 , May 19, 2007
    • 0 Attachment
      >>>>> "essential" == essential quint <quintessential1@...> writes:

      essential> Hello Everyone:

      essential> I use this technique all the time to write HTML:
      essential> print <<EOM;
      essential> ....your HTML code here.....

      essential> EOM

      essential> But I dont know what it's called, so I was wondering if anyone can tell me what the technique is?

      That's called a "here-doc" or a "here-string", because that's what it was
      called in the Bourne Shell docs, where a lot of us cut our teeth.

      essential> Also, I'm a bit comfy with it, but are there any drawbacks to using
      essential> it? I find I can put entire pages of HTML (even headers and direct
      essential> references to $variables) into CGI easily using the technique
      essential> above. It almost seems too good to be true, so I wonder what the
      essential> catch is.

      Look into any of the templating systems, like HTML::Template, or Template
      Toolkit. You'll find that here-docs really don't cut it when you get above a
      few paragraphs of text, in spite of the dozens of counter-examples you'll see
      on the net (mostly written in 1996). The modern way is to use a full
      MVC-system, like Catalyst or Jifty or Bigtop, or my roll-your-own
      CGI::Prototype for the controller and Template for the view.

      Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
      <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
      Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
      See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    Your message has been successfully submitted and would be delivered to recipients shortly.