Beefy Boxes and Bandwidth Generously Provided by pair Networks
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 reply to Fastest way to minimally check that file contains perl code?

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.

update

After finding it again, I realized that it's so detailed that it merits an extra reply.

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

  • Comment on Re: Fastest way to minimally check that file contains perl code?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found