|Perl Monk, Perl Meditation|
Directory of PM fileby tomazos (Deacon)
|on Oct 12, 2005 at 08:53 UTC ( #499421=perlquestion: print w/replies, xml )||Need Help??|
tomazos has asked for the wisdom of the Perl Monks concerning the following question:
How can you get a handle on the directory that a module is located in from within that module's code?
Lets say you have to write a module called Module.pm and you don't know where it will be installed, or which scripts it will be used by, but you know that in the modules parent directory there are some (grep "../*.foo") files you want to process.
Trouble is that grep is going to be relative to the current directory which is not necessarily the modules directory. To go relative to the module you need to be able to find out where it is.
Is that possible?
Back to Seekers of Perl Wisdom