|The stupid question is the question not asked|
Including TT2 templates in module distributionsby matthewb (Curate)
|on Jan 20, 2006 at 16:25 UTC||Need Help??|
matthewb has asked for the wisdom of the Perl Monks concerning the following question:
I have a module here I've been working on that generates Perl code from templates for a purpose particular to its domain.
I'm using the Template Toolkit for my templates and I'm very happy with that. I've got the templates themselves in a subdir called /root.
Now all is well when working locally but I want users to be able to unpack and install my module and the module have access to the templates to do its work.
How might this be possible? Well, I know from the TT docs that Template::Config provides the instdir method which lets you find the location of your TT2 installation and that there's a templates directory there. So maybe some tinkering with the Makefile could get them installed...
...but hang on: what if the module gets installed by someone without superuser privileges or in a non-standard environment for testing purposes?
I note that Maypole/Catalyst have TT2 templates as part of the distribution and have gone down the path of telling you to copy them into your derived application. Is there a tidier way?
Obviously, it's occurred to me to inline them in Perl HEREDOCs but that's not very tidy and I wondered if anyone could do better?