|CC:||<firstname.lastname@example.org>, <email@example.com>, "Eschner, Brian" <Brian.Eschner@Honeywell.com>|
|Subject:||Enhanced code for Perl DIFF.pl program to include -i -w switches|
|Date:||Mon, 1 Aug 2011 12:47:12 -0400|
|From:||"Eschner, Brian" <Brian.Eschner@Honeywell.com>|
Thanks for creating Algorithm-Diff. I’m playing with it to create a program to compare multiple files.
I’m glad I found the diffnew.pl program which emulates the UNIX diff command. (Oh, how I miss working on a UNIX box…) But now I can use this diffnew.pl program on my PC to compare files.
However, I wanted to compare the files but ignore differences due to Case and/or White-Space, so I modified the diffnew.pl program. Please consider the revised program (attached) for inclusion in the next release of the Algorithm-Diff module.
The simple changes I’ve made to add the –i and –w switches are:
· Update the “Usage” section (including adding the missing -q on the Usage: line)
· Declare 2 new OPTion flags: $opt_i and $opt_w
· Declare a new $compareRoutineRef variable to optionally point to the compareRoutine() function (defaults to undef)
· Look for the new –i and –w switches, setting the $compareRoutineRef variable if found
· Pass the $compareRoutineRef variable to the diff function
· Add a line to print “Comparing files: $file1 & $file2…” [This part can be removed if it would hurt existing functionality]
· Declare the compareRoutine() function to modify the text to ignore white-space and/or change case to UpperCase as desired
I would be interested in hearing your response to my enhancements.
Brian D. Eschner
Reliability & Maintainability Engineering
HTSI - Central Engineering
1110 Bayfield Dr.
Colorado Springs, CO 80906
Phone (719) 955-5772
Message body is not shown because sender requested not to inline it.