The stupid question is the question not asked | |
PerlMonks |
Re: Import Constants From File to Templates? (outside-in) (updated)by LanX (Saint) |
on Dec 04, 2021 at 18:50 UTC ( [id://11139392]=note: print w/replies, xml ) | Need Help?? |
> I'd like to include those constants in all my templates directly from my constants module rather than importing them to my script OK if you don't need those constants at all ... Instead of passing the exported constants each time with ->process
> you could make your config module export the initialized TT object
(see also Re: Import Constants From File to Templates?) And if things like $BASE_DIR need to be flexible, provide an import() function. use Sam::Constants base_dir => "...";
editand if you have to manage different constructor setups, export functions which do the different construction and return the specialized $tt object.
update
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|