in reply to Using Text::Diff in windows perl (activeperl) ??

Hi
as per the Text::Diff module specification, you cannot pass a file name directly as OUTPUT. For printing the diff result to a file, you need to pass a file handler as OUTPUT. Please check the following updated code
use warnings; use strict; use Text::Diff; open (FHANDLE, ">result.diff"); print "test test... \n"; my $diff = diff "./test.txt", "./test1.txt", { STYLE => "Unified" , OU +TPUT => \*FHANDLE }; close(FHANDLE);
--lamp

Replies are listed 'Best First'.
Re^2: Using Text::Diff in windows perl (activeperl) ??
by mhd (Novice) on Sep 01, 2008 at 15:34 UTC

    Oops..sorry. Yes,lamp that works! Thank you!! Anyway, forgot to tell that the reason I don't use windows gnu diff is I have to minimize dependency, you know corp. constraint..I try to make so that the users would only required to have activeperl (and better for them to use additional perl module than another external program. Really) to run my script and a visual compare/diff tool(this is different story to tell) that they already have.

    Now what I'm curious is why anonymous monk's reply suggest using Algorithm::Diff and a different perl script. CMIIW, but I thought Text::Diff also use Algorithm::Diff no? what's the difference the perl script that he/she links to and Text::Diff? which one should I use? Or should I use Text::Diff3 (I don't know how to compare 2 files only using Text::Diff3 though)