|There's more than one way to do things|
Re^2: Importing a variable into a packageby frazap (Beadle)
|on May 16, 2018 at 09:35 UTC||Need Help??|
Thanks for the detail explanation !
From my tests with Text::Template, I saw that I had to name variables without the package component to catch syntax errors. Having read the docs (sorry, can't find exactly where) this became clearer.
There is no begin bloc in the loop that gives values to the glob variables Re: Text::Template and delayed use vars as in your last working example
eval ' package T; print "B: $x\n"; 1 ' or warn "B: $@";
This seems to be what happen in the module (version 1.47), around line 309 (the print line is mine):
For a template file starting with
So to be sure I understand correctly: since I use eval during the script runtime, I do not need the begin block to assign a value to the glob. In my example above, the begin was needed because the print statement was run during the execution time. Is that correct ?