in reply to Perl::Critic policy to catch quoted execution?

I'm not good with PPI or Critic, but my understanding is that it's only parsing legal syntax into tokens, and like demonstrated everything behind the -> is just a string.

But maybe this can help?

C:\>perl -MO=Deparse,-q print "A $a->meth or $ref->() or $obj->$meth B"; __DATA__ print 'A ' . $a . '->meth or ' . $ref . '->() or ' . $obj . '->' . $me +th . ' B'; __DATA__ - syntax OK Terminating on signal SIGINT(2)

so you could regex the deparsed output, or search the OP-Tree, or probably tell PPI to check for real strings starting with '->'.

HT(probably)H

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: Perl::Critic policy to catch quoted execution?
by Your Mother (Archbishop) on Sep 22, 2022 at 23:57 UTC

    Oh, that’s fun. Whether or not I end up doing anything related to the original question I’m glad you showed that.