![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Re: Finding files relative to a moduleby GrandFather (Saint) |
on May 15, 2011 at 05:38 UTC ( #904918=note: print w/replies, xml ) | Need Help?? |
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:
which will give a relative or absolute path (depending on where the module is) ending in 'Chess/PGN/Moves.pm'. That is, the file name will need to be stripped off the end of the path. Something like the following may work:
True laziness is hard work
In Section
Seekers of Perl Wisdom
|
|