|laziness, impatience, and hubris|
Re: Finding files relative to a moduleby John M. Dlugosz (Monsignor)
|on May 15, 2011 at 04:26 UTC||Need Help??|
Apparently, realpath( catfile( __PACKAGE__, updir(), 'db' ) ) is producing undef.
Look up and see under what conditions realpath will be undef. Maybe it's being fed undef as one of its arguments?
In any case, what do you really want to do if that value is undef? I'm guessing your logic is that if the directory by that name exists use it, or else use realpath('db'). If it has trouble even figureing out the proposed directory, that is in the same boat, right?
So make it:
In any case, perhaps the problem isn't that the code finding the directory behaves any differently, but that -d used to not warn and now it does? It might has simply said "no, that's not a valid directory" when fed undef before. You can look that up in perldelta or just try it on your existing Perl installation.
Note that you can write it more concisely as:
but then again, the test is the important part and maybe it should still go up front:
saves the excess bracing.