Kernel::System::Diff - Compare two strings and display difference
Compare two strings and display difference.
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');
$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>' }, );
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.