Can anyone decode this Perl code, please?

Carl Banks imbosol at vt.edu
Tue Jan 21 22:52:24 EST 2003


Jane Austine wrote:
> I am reading Object-Oriented Reengineering Patterns. I really enjoy
> this book. On p.177, however, there is a perl code, which is all Greek
> to me. Can anyone here translate it into a pseudo-code or a python
> code(literal translation might do)?
> 
> Thank you so much.
> 
> #! /usr/bin/env perl -w
> #duplocForCPP.pl - detect duplicated lines of code (algorithm only)
> # Synopsis: duplocForCPP.pl filename ...
> # Takes code (or other) files and collects all line numbers of lines
> # equal to each other within these files. The algorithm is linear(in
> # space and time) to the number of lines in input.
[snip code]


It looks like a simple tool to help detect similar lines of C++ code,
as a refactoring aid.  I don't want to translate it because it's too
long (among other things).

The code is not object-oriented, though; and since your book is
entitled _Object-Oriented Reengineering Patterns_, I suspect this is
simply a helper code, that you don't have to understand to get the
point of the book.  If you have Perl installed (good bet if you're
using Unix), you probably could just use it as is, and not worry about
understanding it.


-- 
CARL BANKS




More information about the Python-list mailing list