-
-
Save jacques/477659 to your computer and use it in GitHub Desktop.
Revisions
-
drewblas created this gist
Jul 15, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ # Copyright 2010 Drew Blas <[email protected]> # From: http://drewblas.com/2010/07/15/an-analysis-of-gpled-code-in-thesis # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. use File::Find::Rule; @files = File::Find::Rule->file()->name( '*.php' )->in( 'wordpress/' ); foreach $file (@files) { open(fh, $file) || die "unable to open the file <$file>"; #print "open $file\n"; $line = 1; while( chomp($str = <fh>) ) { $str =~ s/\s+//g; $str = lc($str); $fileHash{$str} = "<$file>:$line" if $str && length($str) > 20; $line += 1; } close(fh); } $lines = keys( %fileHash ); print "Loaded $lines lines\n\n"; @files = File::Find::Rule->file()->name( '*.php' )->in( 'thesis_17/' ); foreach $file (@files) { open(fh, $file) || die "Unable to open the file <$file>"; #print "check $file\n"; $line = 1; while ( chomp($str = <fh>) ) { $c_str = $str; $c_str =~ s/\s+//g; $c_str = lc($c_str); $str =~ s/^\s+//; print "//-- Match from $fileHash{$c_str} to <$file>:$line --\n$str\n\n" if exists $fileHash{$c_str} ; $line += 1; } close(fh); } exit 0;