PerlNavigator icon indicating copy to clipboard operation
PerlNavigator copied to clipboard

Mystery: Deep recursion on anonymous subroutine at /usr/local/share/perl/5.36.0/DBIx/Class/Candy.pm line 255

Open PaulGWebster opened this issue 1 year ago • 3 comments

Good day!

I stumbled across a bit of an oddity probably not a bug, but even so thought I would ask if anyone had any idea what was going on.

I have a pretty normal Mojo OpenAPI service:

image

And I use perlcritic with the community theme: https://metacpan.org/pod/Perl::Critic::Community with a severity rating if 2.

I noticed that for whatever reason I am getting the following warning:

image

So I thought to get more info I would call perlcritic directly (my theme and severity are set via ~/.perlcriticrc so the same settings as vscode is using):

` paulwebster@PAUL-PC-RGB:~/work/shiny-octo-tribble/components/mojo-core$ perlcritic main.pl

main.pl source OK `

Can realistically see no reason why this warning is being raised, anyone able to fill me in on what I missed :)

PaulGWebster avatar Dec 05 '24 21:12 PaulGWebster

Hi @PaulGWebster, I can take a look as well, but I wanted to note that this is not a perlcritic issue. All critic issues are prefixed by Critic: in the diagnostic. This is coming directly from the perl compiler itself as a warning and therefore prefixed as Syntax:. If you run "perl -c" on this file, does it also produce the warning?

bscan avatar Dec 05 '24 22:12 bscan

Hey @bscan great work on the VSCode plugin, very helpful!

To answer your question, no for the script and no for the module:

paulwebster@PAUL-PC-RGB:~/work/shiny-octo-tribble/components/mojo-core$ perl -c /usr/local/share/perl/5.36.0/DBIx/Class/Candy.pm
Name "DBIx::Class::Candy::Exports::methods" used only once: possible typo at /usr/local/share/perl/5.36.0/DBIx/Class/Candy.pm line 141.
Name "DBIx::Class::Candy::Exports::aliases" used only once: possible typo at /usr/local/share/perl/5.36.0/DBIx/Class/Candy.pm line 138.
/usr/local/share/perl/5.36.0/DBIx/Class/Candy.pm syntax OK
paulwebster@PAUL-PC-RGB:~/work/shiny-octo-tribble/components/mojo-core$ perl -c main.pl 
main.pl syntax OK
paulwebster@PAUL-PC-RGB:~/work/shiny-octo-tribble/components/mojo-core$ 

PaulGWebster avatar Dec 05 '24 23:12 PaulGWebster

Hi @PaulGWebster, I'm getting a bit stuck on this one. I installed those dependencies on my machine and I am not able to reproduce the error. Perhaps one of your local dependencies is doing something? If you can keep removing dependencies until you isolate the issue, that could be helpful. For example, if a file contains only use DBIx::Class::Candy, does it trigger?

Another possibility is the symbol table inspection is throwing an error or somehow interacting with DBIx::Class::Candy. One of the ways that the Navigator finds symbol information is by compiling the file and then walking through the symbol table and through class hierarchies introspecting things leftover after compilation. If you check the Perl Navigator logs (see this comment for details if needed: https://github.com/bscan/PerlNavigator/issues/147#issuecomment-2438593203 ), you should be able to rerun the perl -c navigator command and see if it reproduces the error. It'll be something like this, where the Inquisitor does the inspection at the end of compilation.

Starting perl compilation check with the equivalent of: /home/brian/perl5/perlbrew/perls/perl-5.38.0/bin/perl -c -I /home/brian/.vscode-server/extensions/bscan.perlnavigator-0.8.15/server/src/perl -MInquisitor /tmp/test.pl

The output will be fairly large, so you may need to pipe it to a file first and then see if the warning shows up. Thanks!

bscan avatar Dec 06 '24 18:12 bscan