Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perl::Critic policy to catch quoted execution?

by LanX (Saint)
on Sep 22, 2022 at 22:41 UTC ( [id://11147066]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147066]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-26 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found