skazat has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monks,
I'm currently converting a templating system that has HTML mixed up with Perl code (yuck!) with HTML::Template.
I'm currently doing this in a few steps:
1) Convert my code in HTML::Template code inline
2) Moving this inline code into a separate file in a separate directory
#1 Was nothing. Cake. All done.
#2 is more difficult, as I don't want to have another Config variable need to be set for my program.
My idea for a solution to this problem was to store the templates in a directory below where my module is, for example, if the module is at:
myprogram/lib/Stuff/MyTemplate.pm
I wanted the templates to be at:
myprogram/lib/Stuff/templates
(at the moment, I don't want the templates servicable, only outside of my program's Perl code)
My idea for a solution to this problem was to find the absolute path of where the Templating functions are (in this case, they're in a separate module, not a part of the *.cgi file)
The problem with this route is that I can't for the life of me, figure out how to find the absolute path to my module; __FILE__ only stores something like,
lib/Stuff/MyTemplate.pm,
not
/home/me/lib/stuff/MyTemplate.pm
This:
Gives the same thing.use File::Spec; print File::Spec->rel2abs(__FILE__);
So, is there a way to find the absolute path to a module, from the module's, perspective (not from the perspective of the perl script which will use()/require() it)?
-justin simoni
!skazat!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: finding the absolute path to a module, from the module's, perspective
by Zaxo (Archbishop) on Sep 12, 2004 at 02:14 UTC | |
|
Re: finding the absolute path to a module, from the module's, perspective
by PodMaster (Abbot) on Sep 12, 2004 at 02:11 UTC | |
by skazat (Chaplain) on Sep 12, 2004 at 04:36 UTC | |
by PodMaster (Abbot) on Sep 12, 2004 at 04:51 UTC | |
by skazat (Chaplain) on Sep 12, 2004 at 05:00 UTC | |
by ysth (Canon) on Sep 12, 2004 at 06:55 UTC |