in reply to Including TT2 templates in module distributions
You could put them in a dir relative to your module, then use %INC to locate them.
use My::Module; use File::Spec; my $path = $INC{'My/Module.pm'}; $path = File::Spec->rel2abs($path); my ($vol, $dir, $file) = File::Spec->splitpath($path); $path = File::Spec->catpath($vol, $dir, ''); $path = File::Spec->catdir($path, 'templates'); print("$path\n");
Update: splitpath didn't work with relative directories. Fixed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Including TT2 templates in module distributions
by matthewb (Curate) on Jan 20, 2006 at 16:40 UTC |