I’m creating my own module, lets call it X::Y. Of course, the module will be in the file X/Y.pm.
Lets say Y needs to call an external program, prog. Ideally I’d just like to put prog in X, so I can run X/prog. I’d like to not have hardcode X/progs full path, and for the module to work regardless of the current working directory set.
How can I find the full path of a module from inside a module? Or is there a better way to do this?
The full path to the source file currently being executed is supplied by Perl’s
__FILE__special literal.However I would prefer to see the external program installed where it would normally be, and the path there either coded as a constant in the Perl code or included in the
PATHenvironment variable.