Closed zorgnax closed 1 year ago
Since Perl 5.26, the standard search for libraries no longer looks in the "current directory".
To use local directories, you should use FindBin:
package main 1.0;
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib/foo";
I have used this successfully with the VSCode Perl extension...
I'm on 5.30.3 and if I put in a use lib "lib";
it works, like it can include the file and run the perl code in it, but the VS Code debugger doesn't show it.
Look in the Readme at FAQ, e.g. "Module not found when debugging or during syntax check"
Thanks for pointing me to that, but I guess I still don't understand why it is that way. Setting the perl.perlInc will work fine for me, but it is an extra step.
That's because the current working directory is not defined, when starting inside the debugger. You can set it with perl.cwd
. You are using a releative path, so the current working directory matters and the debugger cannot know, what you assume as current working directory.
I am running into a problem where I try to debug in VSCode a script that uses a module in a local directory and it returns this error when I step into the function defined in a local .pm file:
The script has this code in it:
And it is trying to use a file in ./lib/Foo.pm with this code in it: