in reply to Re: 'Here Documents' and unrecognized escapes
in thread 'Here Documents' and unrecognized escapes

I have done some reading of the manual pages that come with 'Template' and it seems pretty well suited to my needs. However one issue which makes it a little less than ideal is the fact it seems to require the template to be a separate text file, marked up apropriately. Have I got that right? Or can you use a string instead with the same markup? I suppose I could always write a temporary template file on the fly FROM a variable and then delete it when i am done... That feels like it defeats the object though!

"Aure Entuluva!" - Hurin Thalion at the Nirnaeth Arnoediad.
  • Comment on Re^2: 'Here Documents' and unrecognized escapes

Replies are listed 'Best First'.
Re^3: 'Here Documents' and unrecognized escapes
by Corion (Patriarch) on May 04, 2014 at 18:19 UTC

    The second example in the Template Toolkit documentation shows how to pass it a string for the template:

    # text reference $text = "[% INCLUDE header %]\nHello world!\n[% INCLUDE footer %]" +; $tt->process(\$text) || die $tt->error(), "\n";

      Right you are Corion!

      Would you believe I just went back to the root manual page and noticed that. Sometimes the raw CPAN documentation can be a bit intimidating so I tend to look for tutorials first.

      Incorporating that information and... all is well. I'm suddenly a 'Template' library fan!!!

      "Aure Entuluva!" - Hurin Thalion at the Nirnaeth Arnoediad.