I have a feeling the proposed solutions above don't give you the path relative to the module
, but to the script
Cwd is the simplest solution though:
use Cwd qw(abs_path getcwd);
print "This script is: ".abs_path($0)."\n";
print "Working dir is: ".getcwd()."\n";
but that won't tell you the path from the actual module.
For that, you'll need to hard code the path to the module (I think):
my $abs_filepath = abs_path("$module_dir/$relative_pilepath");
__FILENAME__ is your friend...