[sf-perl] Q: arbitrary diffs and SVN::Notify::HTML

Kevin Frost biztos at mac.com
Wed Jun 25 00:59:27 PDT 2008

You can do all of these things with Text::Diff together with  
Text::Diff::HTML.  It assumes very little about your ultimate purpose,  
leaving you free to assemble and style things as you see fit.


     use strict;
     use warnings;

     use Text::Diff qw(diff);
     use Text::Diff::HTML;

     my $old = "I'm <old!>\nWooha!\n";
     my $new = "I'm <new!>\nWooha!\n";

     my $frag = diff( \$old, \$new, { STYLE => 'Text::Diff::HTML' } );

     # Now do something better than this:
     print "<html><body><pre>$frag</pre></body></html>\n";



I'm not sure if Dave Wheeler is on the list, but that's his code so  
this might serve as a temporary proxy until he says something  
smarter. ;-)


-- frosty

On Jun 24, 2008, at 4:46 PM, greg lee coleman [1482] wrote:

> (purrhaps this should be titled paging David Wheeler since i thought  
> he was on
> this list...)
> i'm wondering if SVN::Notify or any other package can do diffs in  
> HTML --with
> just a simple diff of 2 scalars, eg.
> 	my $diff = diff_these_things( $a, $b )
> where $a and $b are scalars (optimal), or filehandles ( less  
> optimal) or files
> (even further from the point).
> i'm looking for a quick way to get HTML diffs of 2 arbitrary files  
> (ie. they are
> not in rcs,cvs or svn).  I'd love to leverage the beauty of  
> SVN::Notify::HTML
> thanks in advance!
> -gleeco
> ________________________________________________________________
> Gregory  Coleman   Adv. Search Technologies, CNET Networks, Inc.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm

More information about the SanFrancisco-pm mailing list