Perl Readonly while Debugging

Sure.

Environment: Windows 7, x64. Komodo IDE 9.0. ActiveState perl 5.20.1

Using a perl project, with perl modules in a “lib”, such as lib/MyTest.pm
run a perl script such as

use lib 'lib';
use MyTest;

chdir '/some/other/path';
my $foo = MyTest->new();

Then, when debugging the script (locally or via listener), stepping into the “new” method triggers the map-URI dialog which indicates it’s trying to find MyTest.pm inside “/some/other/path/lib”.
Expected: Komodo finds the module in the project ‘lib’ folder.

After aborting the map-URI dialog, Komodo is still able to open a read-only instance of the file.

Ok, it sounds like you are seeing a different issue than what @ghanoch is seeing. You’re saying a perl file effectively becomes read-only when you are debugging it?

Right. This isn’t the same issue. The nuisance is actually less the fact that it opens readonly, but that I have to go through the map URI dialog each time and end up with a new tab (losing any breakpoints etc).

Have you tried setting up the mapping under Prefs > Mapped URLs?

1 Like

Moved these posts to their own topic

Yes. The mapping has no effect. The file is still opened readonly and the Map-URI dialog comes up again the next time.

I’ve worked around this by using absolute includes in the perl scripts;

use Cwd;
my $libdir;
BEGIN {
    $libdir = File::Spec->catdir( getcwd, 'lib' );
};
use lib "$libdir";

It sounds like the mapping isn’t being recognized. Is there anything out of the ordinary about your files? Are they on a symlink, remote dir, … ?

Actually, this isn’t a problem with mapping. The map-URI dialog is just a side effect. What I can see from the dialog is that it’s trying to open files from the wrong folder. In the test scenario, the library might be in /myproject/lib/, but the dialog is looking for it in /some/other/path/lib (the target of the chdir in the code), so it’s attaching the relative path to the current directory at runtime, rather than the current directory at start time. This is only a problem because the library was already loaded by perl using the starttime path.

Ok, thanks for clarifying. I’ve opened a bug report for the issue here: https://github.com/Komodo/KomodoEdit/issues/97