Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Fastest way to minimally check that file contains perl code?by LanX (Saint) |
on Mar 13, 2020 at 12:06 UTC ( [id://11114216]=note: print w/replies, xml ) | Need Help?? |
In general: 80% should be easy enough to achieve, use some rough regex to strip all variables with sigils and function calls and comments and count the built in commands... A quick search didn't show any cpan modules for that (which is most likely due to my search strategy) I know about JS libraries for syntax highlighting guessing the code. The recommended technique is to train a classifier based on a "term frequency algo" (see tf-idf) with right and wrong code,( problem here is I don't know your wrong code, PHP should pose the biggest problem) We also had a similar discussion in the past in order to decide if a poster forgot code tags.
updateAfter finding it again, I realized that it's so detailed that it merits an extra reply.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|