| Server IP : 216.92.14.13 / Your IP : 216.73.216.171 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/bin/ |
Upload File : |
#!/usr/bin/perl
#
# htmldiff uses HTML::Diff to create an HTML file that shows the difference
# between two HTML files, given on the command line.
#
# Contributed by Maurice Aubrey <maurice@redweek.com>
#
use strict;
use HTML::Diff;
@ARGV == 2 or die "Usage: $0 <file1> <file2>\n";
my @txt;
foreach (@ARGV) {
open my $fh, $_ or die "unable to read '$_': $!";
local $/;
push @txt, scalar <$fh>;
}
print qq{<style type="text/css"><!-- ins{color: green} del{color:red}--></style>\n};
foreach (@{ html_word_diff(@txt) }) {
my($type, $left, $right) = @$_;
# debug
#$left =~ s/\n/ /g;
#$right =~ s/\n/ /g;
#print "TYPE:$type\nLEFT: $left\nRIGHT: $right\n\n";
#next;
if ($type eq 'u') {
print $left;
} else {
print "<del>$left</del>" if length $left;
print "<ins>$right</ins>" if length $right;
}
}