NAME
Kernel::System::Diff – Compare two strings and display difference
DESCRIPTION
Compare two strings and display difference.
PUBLIC INTERFACE
new()
create an object. Do not use it directly, instead use:
use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $DiffObject = $Kernel::OM->Get('Kernel::System::Diff');
Compare() Compare two strings and return diff.
$DiffObject->Compare(
Source => 'String 1', # (required) String
Target => 'String 2', # (required) String
);
Result:
my %Diff = (
HTML => '<table class="DataTable diff">
<tr class=\'change\'><td><em>1</em></td><td><em>1</em></td><td>Test <del>1</del></td><td>Test <ins>2</ins></td></tr>
</table>
',
Plain => '<div class="file"><span class="fileheader"></span><div class="hunk"><span class="hunkheader">@@ -1 +1 @@
</span><del>- Test 1</del><ins>+ Test 2</ins><span class="hunkfooter"></span></div><span class="filefooter"></span></div>'
},
);