Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

  (email not shown publicly)

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm :,,
lug : Devon & Cornwall LUG
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl []
flickr :hashbangperl []

Journal of TeeJay (2309)

Thursday March 13, 2003
07:07 AM

Copy & Paste Detect

[ #11017 ]
Once again I found a nice article in onJava that I really want in perl - the Copy and Paste Detect application.

This would be *so* useful in perl. We have a project with quite a lot of heavily repeated sql and perl that could do with refactoring but currently works and is not worth refactoring by hand.

CPD would help greatly especially if we can also look for things like map in void context and undocumented / commented functions or functions without specified prototypes, etc.

Now I just need a perl or similar tokenizer, a module providing a nice Greedy String Tiling or similar algorithm and we will be away.


The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I was interested to run across PMD [], the software on which the Copy/Paste Detector runs. Though it's not possible to do that sort of static analysis in Perl, there are ways to do something very similar. I've resurrected my long-dormant bytecode-to-XML project.

    PMD uses treecc [] to build an AST, then uses the Visitor pattern to call an event for each node in the tree. From there, he looks for specific patterns of nodes. It's a little tricky, but you can build up a sort of state machine.

    My code is B::S