http://qs1969.pair.com?node_id=499421

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?

-Andrew.