Search code examples
eclipseperlepic

Why aren't perl variables showing in the eclipse debugger with perl EPIC?


Here is my system configuration.

Perl-Epic 0.7.8

Strawberry Perl 5.32.1 64 bit.

PadWalker 2.5 installed with Strawberry perl

Here is what I have already read. http://www.epic-ide.org/faq.php#debug

In my case, the message "perl5db.pl did not return a true value." is not displayed in the console. Also the bug report mentioned in that FAQ has been resolved so I would think that things should be working on the latest windows version of Perl by now. Also that issue appears to be related to a win32 specific subroutine that doesn't exist in my perl installation since it is a win64 install.

https://sourceforge.net/p/e-p-i-c/bugs/711/ This might be related, but not sure. My program which only involves two variables follows.

Unable to view locals in Eclipse + EPIC

I do tried the latest stable and testing versions of EPIC. Both produced the same result.

Here is a simple test program.

#!/usr/bin/perl
$a = 1;   
$b=2;     
print($a+$b);

[Debug Session

Update

If I declare the variables explicitly then they show in the debugger. Within one of the other threads I noticed that the asker did not declare using the my keyword either. That is an opportunity for someone to answer with a confirmation of whether this is how PadWalker works. The documentation for it mentions that it works on lexical variables which are in scope. I'm new to Perl programming and learning it due to scripts that I have to learn to maintain so I am unsure if my interpretation of the documentation is correct. However, I think that is the answer that the variables must be declared so that each has a scope. Please advise.

enter image description here


Solution

  • The answer appears to lie in the module documentation for PadWalker which states, "PadWalker is a module which allows you to inspect (and even change!) lexical variables in any subroutine which called you. It will only show those variables which are in scope at the point of the call." The key point is that declaring the variable with the my keyword is what causes the variable to be declared with scope.

    Moreover, the PERL-EPIC documentation for Eclipse indicates that it relies on PadWalker to provide a debug capability. Therefore the ability to inspect variables in the Eclipse debugger using that specific plugin depends on explicitly declaring variables.

    You can see in the image here that the variables show up when declared.
    enter image description here