Find Duplicate Code in Perl
SIZE=5120 perl -MCode::DRY \
-e 'Code::DRY::scan_directories(-$ENV{SIZE}, undef, undef, undef, @ARGV)' \
lib/
The command does impressive job on finding 'Cut-and-Paste' duplicates and does it fast even on huge codebases.
SIZE
variable defines a minimum number of bytes to be considered as duplicate.
The command requires Code::DRY module to be preinstalled.
CP_reporter script from the same distribution provides better reporting interface, but accepts just one dir or a glob.
The module by Heiko "hexcoder" Eißfeldt borrows some ideas from Ovid's implementation and benefits from use of various algorithms and XS performance gains.
Written by Yaroslav Korshak
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Perl
Authors

janosgyerik
25.23K

Jean-Remy Duboc
12.29K
Related Tags
#perl
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#