Just another Perl shrine | |
PerlMonks |
finding the absolute path to a module, from the module's, perspectiveby skazat (Chaplain) |
on Sep 12, 2004 at 02:01 UTC ( [id://390358]=perlquestion: print w/replies, xml ) | Need Help?? |
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. 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
Back to
Seekers of Perl Wisdom
|
|