Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: 'Here Documents' and unrecognized escapes

by morelenmir (Beadle)
on May 04, 2014 at 18:15 UTC ( [id://1084956]=note: print w/replies, xml ) Need Help??


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.

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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-28 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found