in reply to Finding files relative to a module

Looks like you are hoping that catfile( __PACKAGE__, updir(), 'db' ) will find the folder 'db' relative to the folder containg the .pm file. However __PACKAGE__ is Chess::PGN::EPD which is unlikely to be what you mean and updir() removes it in any case so the catfile call is effectively catfile('db') which returns 'db' without the context you seem to be hoping for.

A technique that may help is to look up %INC for the module entry:

my $modulePath = $INC{'Chess/PGN/'};

which will give a relative or absolute path (depending on where the module is) ending in 'Chess/PGN/'. That is, the file name will need to be stripped off the end of the path. Something like the following may work:

... use File::Spec::Functions qw(rel2abs splitpath updir catdir); use Cwd qw(realpath); my $loadPath = rel2abs ($INC{'Chess/PGN/'}); my @parts = splitpath ($loadPath); my $db_dir_qfn = realpath (catdir (@parts[0, 1], updir(), 'db'));
True laziness is hard work