Item10093: Is the CPAN module Text::Diff really required?

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.3
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: IngoKappler
Waiting For: Main.KennethLavrsen
Last Change By: KennethLavrsen
I am under the impression that we actually don't use the CPAN module Text::Diff although it is claimed in InstallationGuide#CPAN_modules (InstallationGuide#Required_CPAN_modules) to be required and is also shipped with Foswiki.

I stumbled over it after adding it to the file lib/DEPENDENCIES and then found it was reported not to be available. This also indicates some issue with either detecting this module in the Foswiki internal CPAN delivery or a delivery issue in its own.

However, installing it separately via CPAN and also via Debian package resolved the reporting issue.

To find out if the module is used at all I run few greps with these results:
foswiki-branch01x01# grep -r Text::Diff * | fgrep -v CPAN
core/data/System/InstallationGuide.txt:| Text::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |
core/data/System/.svn/text-base/InstallationGuide.txt.svn-base:| Text::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |

foswiki-trunk# grep -r Text::Diff * | fgrep -v CPAN
core/data/System/InstallationGuide.txt:| Text::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |
core/data/System/.svn/text-base/InstallationGuide.txt.svn-base:| Text::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |
Übereinstimmungen in Binärdatei WikiBot/factoids-are.pag.
Übereinstimmungen in Binärdatei WikiBot/factoids-are.dir.
Übereinstimmungen in Binärdatei WikiBot/.svn/text-base/factoids-are.dir.svn-base.
Übereinstimmungen in Binärdatei WikiBot/.svn/text-base/factoids-are.pag.svn-base.

It looks like we only list it in InstallationGuide#CPAN_modules because it also uses module Algorithm::Diff which indeed is required:

foswiki-branch01x01# grep -r Algorithm::Diff * | fgrep -v CPAN
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm:use Algorithm::Diff;
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm:    my @changes = Algorithm::Diff::sdiff( \@list1, \@list2, \&_elementHash );
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm:                && Algorithm::Diff::LCS( \@sublist1, \@sublist2,
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm:          Algorithm::Diff::sdiff( \@list1, \@list2, \&_elementHash );
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm:    # Purpose: Stringify HTML ELement for comparison in Algorithm::Diff
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm:    my @changes = Algorithm::Diff::sdiff( \@list1, \@list2 );
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/.svn/text-base/Compare.pm.svn-base:use Algorithm::Diff;
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/.svn/text-base/Compare.pm.svn-base:    my @changes = Algorithm::Diff::sdiff( \@list1, \@list2, \&_elementHash );
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/.svn/text-base/Compare.pm.svn-base:                && Algorithm::Diff::LCS( \@sublist1, \@sublist2,
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/.svn/text-base/Compare.pm.svn-base:          Algorithm::Diff::sdiff( \@list1, \@list2, \&_elementHash );
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/.svn/text-base/Compare.pm.svn-base:    # Purpose: Stringify HTML ELement for comparison in Algorithm::Diff
CompareRevisionsAddOn/lib/Foswiki/Contrib/CompareRevisionsAddOn/.svn/text-base/Compare.pm.svn-base:    my @changes = Algorithm::Diff::sdiff( \@list1, \@list2 );
CompareRevisionsAddOn/data/System/CompareRevisionsAddOn.txt:      * Algorithm::Diff (which is included in the standard Foswiki installation
CompareRevisionsAddOn/data/System/.svn/text-base/CompareRevisionsAddOn.txt.svn-base:      * Algorithm::Diff (which is included in the standard Foswiki installation
core/lib/Foswiki/Merge.pm:    require Algorithm::Diff;
core/lib/Foswiki/Merge.pm:    Algorithm::Diff::traverse_balanced(
core/lib/Foswiki/Merge.pm:    require Algorithm::Diff;
core/lib/Foswiki/Merge.pm:    Algorithm::Diff::traverse_balanced(
core/lib/Foswiki/Merge.pm:    require Algorithm::Diff;
core/lib/Foswiki/Merge.pm:    my @bdiffs = Algorithm::Diff::sdiff( \@a, \@b );
core/lib/Foswiki/Merge.pm:    my @cdiffs = Algorithm::Diff::sdiff( \@a, \@c );
core/lib/Foswiki/Merge.pm:    # Algorithm::Diff. We'll consume whatevers left if necessary though.
core/lib/Foswiki/Store/VC/RcsLiteHandler.pm:    require Algorithm::Diff;
core/lib/Foswiki/Store/VC/RcsLiteHandler.pm:    my $diff = Algorithm::Diff::sdiff( $lNew, $lOld );
core/lib/Foswiki/Store/VC/RcsLiteHandler.pm:    require Algorithm::Diff;
core/lib/Foswiki/Store/VC/RcsLiteHandler.pm:    my $diffs = Algorithm::Diff::diff( $new, $old );
core/lib/Foswiki/Store/VC/RcsWrapHandler.pm:| #Description: | unlike Algorithm::Diff I concatinate lines of the same diffType that are sqential (this might be something that should be left up to the renderer) |
core/lib/Foswiki/Store/VC/.svn/text-base/RcsLiteHandler.pm.svn-base:    require Algorithm::Diff;
core/lib/Foswiki/Store/VC/.svn/text-base/RcsLiteHandler.pm.svn-base:    my $diff = Algorithm::Diff::sdiff( $lNew, $lOld );
core/lib/Foswiki/Store/VC/.svn/text-base/RcsLiteHandler.pm.svn-base:    require Algorithm::Diff;
core/lib/Foswiki/Store/VC/.svn/text-base/RcsLiteHandler.pm.svn-base:    my $diffs = Algorithm::Diff::diff( $new, $old );
core/lib/Foswiki/Store/VC/.svn/text-base/RcsWrapHandler.pm.svn-base:| #Description: | unlike Algorithm::Diff I concatinate lines of the same diffType that are sqential (this might be something that should be left up to the renderer) |
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    require Algorithm::Diff;
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    Algorithm::Diff::traverse_balanced(
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    require Algorithm::Diff;
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    Algorithm::Diff::traverse_balanced(
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    require Algorithm::Diff;
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    my @bdiffs = Algorithm::Diff::sdiff( \@a, \@b );
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    my @cdiffs = Algorithm::Diff::sdiff( \@a, \@c );
core/lib/Foswiki/.svn/text-base/Merge.pm.svn-base:    # Algorithm::Diff. We'll consume whatevers left if necessary though.
core/lib/Foswiki/UI/RDiff.pm:#          corresponding to Algorithm::Diff's output
core/lib/Foswiki/UI/.svn/text-base/RDiff.pm.svn-base:#          corresponding to Algorithm::Diff's output
core/tools/mergeDoc.pl:use Algorithm::Diff;
core/tools/mergeDoc.pl:            $diff = Algorithm::Diff->new(\@svnLines, \@twikiLines);
core/tools/mergeDoc.pl:            $diff = Algorithm::Diff->new(\@twikiLines, \@svnLines);
core/tools/.svn/text-base/mergeDoc.pl.svn-base:use Algorithm::Diff;
core/tools/.svn/text-base/mergeDoc.pl.svn-base:            $diff = Algorithm::Diff->new(\@svnLines, \@twikiLines);
core/tools/.svn/text-base/mergeDoc.pl.svn-base:            $diff = Algorithm::Diff->new(\@twikiLines, \@svnLines);
core/data/System/InstallationGuide.txt:| Algorithm::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |
core/data/System/.svn/text-base/InstallationGuide.txt.svn-base:| Algorithm::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |
TestFixturePlugin/lib/Foswiki/Plugins/TestFixturePlugin/HTMLDiffer.pm:use Algorithm::Diff;
TestFixturePlugin/lib/Foswiki/Plugins/TestFixturePlugin/HTMLDiffer.pm:    my $diffs = Algorithm::Diff::sdiff( $e, $a );
TestFixturePlugin/lib/Foswiki/Plugins/TestFixturePlugin/.svn/text-base/HTMLDiffer.pm.svn-base:use Algorithm::Diff;
TestFixturePlugin/lib/Foswiki/Plugins/TestFixturePlugin/.svn/text-base/HTMLDiffer.pm.svn-base:    my $diffs = Algorithm::Diff::sdiff( $e, $a );
TestFixturePlugin/lib/Foswiki/Plugins/TestFixturePlugin.pm:# 1 Have Algorithm::Diff installed
TestFixturePlugin/lib/Foswiki/Plugins/.svn/text-base/TestFixturePlugin.pm.svn-base:# 1 Have Algorithm::Diff installed
TestFixturePlugin/data/System/TestFixturePlugin.txt:A test pass will generate an appropriate plain text message in the browser. A test failure is reported in a +diff= - style table. If neither of these outcomes is seen, and the topic renders as normal, then there is a problem with the installation (did you install Algorithm::Diff?)
TestFixturePlugin/data/System/TestFixturePlugin.txt:    1 The comparison is performed by Algorithm::Diff, which compares the HTML structures found in the text. See the documentation on Algorithm::Diff for help.
TestFixturePlugin/data/System/TestFixturePlugin.txt:|  Dependencies: | Algorithm::Diff |
TestFixturePlugin/data/System/.svn/text-base/TestFixturePlugin.txt.svn-base:A test pass will generate an appropriate plain text message in the browser. A test failure is reported in a +diff= - style table. If neither of these outcomes is seen, and the topic renders as normal, then there is a problem with the installation (did you install Algorithm::Diff?)
TestFixturePlugin/data/System/.svn/text-base/TestFixturePlugin.txt.svn-base:    1 The comparison is performed by Algorithm::Diff, which compares the HTML structures found in the text. See the documentation on Algorithm::Diff for help.
TestFixturePlugin/data/System/.svn/text-base/TestFixturePlugin.txt.svn-base:|  Dependencies: | Algorithm::Diff |
UnitTestContrib/lib/Foswiki/Contrib/UnitTestContrib/DEPENDENCIES:Algorithm::Diff,>=0,cpan,required
UnitTestContrib/lib/Foswiki/Contrib/UnitTestContrib/.svn/text-base/DEPENDENCIES.svn-base:Algorithm::Diff,>=0,cpan,required
UnitTestContrib/lib/Unit/HTMLDiffer.pm:use Algorithm::Diff;
UnitTestContrib/lib/Unit/HTMLDiffer.pm:    my $diffs = Algorithm::Diff::sdiff( $e, $a );
UnitTestContrib/lib/Unit/.svn/text-base/HTMLDiffer.pm.svn-base:use Algorithm::Diff;
UnitTestContrib/lib/Unit/.svn/text-base/HTMLDiffer.pm.svn-base:    my $diffs = Algorithm::Diff::sdiff( $e, $a );
UnitTestContrib/test/unit/DependencyTests.pm:    # 1, Algorithm::Diff v1.19_01 loaded
UnitTestContrib/test/unit/DependencyTests.pm:            module  => "Algorithm::Diff",
UnitTestContrib/test/unit/DependencyTests.pm:    $this->assert_matches( qr/Algorithm::Diff version \d+\.\d+(?:_\d+)? loaded/,
UnitTestContrib/test/unit/.svn/text-base/DependencyTests.pm.svn-base:    # 1, Algorithm::Diff v1.19_01 loaded
UnitTestContrib/test/unit/.svn/text-base/DependencyTests.pm.svn-base:            module  => "Algorithm::Diff",
UnitTestContrib/test/unit/.svn/text-base/DependencyTests.pm.svn-base:    $this->assert_matches( qr/Algorithm::Diff version \d+\.\d+(?:_\d+)? loaded/,

Therefore I recommend removing Text::Diff from InstallationGuide#CPAN_modules and to also remove it from the shipped set of CPAN modules.

-- IngoKappler - 29 Nov 2010

If the module is not needed in core or default plugins then it should not be in the installation guide.

We may want to keep it in our CPAN lib in core if some popular plugins use it just to avoid upgraders getting in trouble. If the core does not use it, it will not cause any load on the perl execution

-- KennethLavrsen - 30 Nov 2010

Even on my trunk checkout with all the plugins nothing more is found:

foswiki-trunk# grep -r Text::Diff * | fgrep -v CPAN
core/data/System/InstallationGuide.txt:| Text::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |
core/data/System/.svn/text-base/InstallationGuide.txt.svn-base:| Text::Diff | | %ORANGE%Required%ENDCOLOR% | *Included* with Foswiki |
Übereinstimmungen in Binärdatei WikiBot/factoids-are.pag.
Übereinstimmungen in Binärdatei WikiBot/factoids-are.dir.
Übereinstimmungen in Binärdatei WikiBot/.svn/text-base/factoids-are.dir.svn-base.
Übereinstimmungen in Binärdatei WikiBot/.svn/text-base/factoids-are.pag.svn-base.

Unless objections are raised, I will remove it from the installation guide. If someone would also confirm to remove it from Foswiki internal CPAN, I would do that too.

-- IngoKappler - 01 Dec 2010

Answer from OlivierRaginel by mail:

Maybe remove it also from CpanContrib, so that it's totally erased. It's true it's only legacy. Could lead to some issues for anybody have written some "darkpan" plugin relying on it, but it's unlikely, and easily fixable. It just needs proper announcement in the release notes, I guess."

-- IngoKappler - 01 Dec 2010

I am in favor of getting a confirmation from WillNorris to also remove it from the CPAN contrib because I've seen a few more text related modules there which also might not be required. So maybe others are using just more than required and it should stay on that contrib?

-- IngoKappler - 01 Dec 2010

Ok, WillNorris also removed it from CpanContrib, so changing this task to "Waiting for Release" as everything should be cleaned up now.

-- IngoKappler - 01 Dec 2010

Except you forgot to remove it from the MANIFEST, so one cannot build a release anymore...

-- OlivierRaginel - 03 Dec 2010

Sorry for the inconvenience! When removing a file next time, I will remember that.

-- IngoKappler - 03 Dec 2010
 

ItemTemplate edit

Summary Is the CPAN module Text::Diff really required?
ReportedBy IngoKappler
Codebase 1.1.2
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor KennethLavrsen
Checkins distro:e7e936eb784c distro:1147dcaddf22 Rev 10143 not found distro:cd496d552117 distro:aa6fc570a3f0 distro:1ba5c8a2f5f9
TargetRelease patch
ReleasedIn 1.1.3
Topic revision: r21 - 16 Apr 2011, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy