MRWolf has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to access template files during run time. What's a good practice for doing this?
I just learned about File::ShareDir and how it works with the share_dir directive of Module::Build and Module::Install.
This is great, since production code can do something like:
use File::ShareDir;
my $template_file = File::ShareDir::module_file('Module::Name', 'template/resume.tt')
But this doesn't seem to help me during development and test, where I'm used to accessing things (i.e. modules, scripts) from ../blib without having to install them.
Is there an analog to blib for share_dir so that I can use the same code in dev/test as I do in production?
And beyond the pre- vs. post- question relating to 'Build install', is there a recommended directory structure for where to hang the templates relative to the modules or relative to the distribution? Even lacking a recommendation, could you point me to a distribution that uses TT so that I could study how it does it?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dirctory structure for TT2 templates (in test *and* production)
by Your Mother (Archbishop) on Nov 30, 2010 at 19:49 UTC | |
by MRWolf (Initiate) on Dec 02, 2010 at 06:02 UTC | |
by Your Mother (Archbishop) on Dec 02, 2010 at 16:00 UTC |