Perl "test merge"
Thanks for all the help with the earlier questions I've posted
I am trying to do something I've seen in other perl code bases but I
don't know how they do it.
You have a text -file- (html, usually) and it looks like this:
Some more text !!$someperlvariable!!
and if $someperlvariable = "merge stuff" you end up with
Some more text merge stuff
Now the point is, this should work for any variable defined in the
parent code, not just the one particular one. (Obviously it would be
easy if the only variable I had to worry about was $someperlvariable)
If I define a string in perl as "some text $someperlvariable more
text" then perl does what I want, the value of $someperlvariable goes
into the string rather than "$someperlvariable".
But if I load the string from a file this doesn't seem to work.
It seems to be at least a somewhat common practice (using the double
"!!" or other delimiters to indicate dynamic content to be merged in),
it seems like I've seen it done in other code bases than the one I
first saw it in.
Does anybody know how to do this?
Summoning his cosmic powers
and blowing slightly from his toes
the psychic emanations flow
- Syd Barret
Re: Perl "text merge"
oops, that should have been "text merge"
"So is it like a tree that falls in the forest with nobody there to hear it?"
"I feel sorry for that tree" said Carter
- Glen Gold
Re: Perl "test merge"
Text::Template was what I was looking for
Sorry for the newbie question/s
EMBRACE the SUCKINESS
|All times are GMT. The time now is 02:41 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.