• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5554: Missuse of sort and loops

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Low Closed   patch 4.2.1

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

In the Progress of tweaking TWiki to be installed as RPM in a clean way and customizing it for our needs I find some issues. One is the follow.

It is not that buggy but it is a completely wast of resources and a pain in the eyes. Sorting keys of a hash to loop over it and finally put the result back to another hash (which makes the order explicit unsorted!)...

Well, there are bugs which are more important but this just hurts in the eyes.

diff -Nur TWiki-4.1.2.orig/lib/TWiki/UI/Manage.pm TWiki-4.1.2/lib/TWiki/UI/Manage.pm
--- TWiki-4.1.2.orig/lib/TWiki/UI/Manage.pm   2007-03-03 15:45:57.000000000 +0100
+++ TWiki-4.1.2/lib/TWiki/UI/Manage.pm   2007-12-12 11:29:13.000000000 +0100
@@ -490,12 +490,7 @@
         # and build up a hash containing permissions and lock info.
         $refs0 = getReferringTopics( $session, $oldWeb, undef, 0 );
         $refs1 = getReferringTopics( $session, $oldWeb, undef, 1 );
-        foreach my $ref (sort keys %$refs0) {
-            $refs{$ref} = $refs0->{$ref};
-        }
-        foreach my $ref (sort keys %$refs1) {
-            $refs{$ref} = $refs1->{$ref};
-        }
+   %refs = (%$refs0, %$refs1);
         $webTopicInfo{referring}{refs0} = $refs0;
         $webTopicInfo{referring}{refs1} = $refs1;

-- KlausEthgen - 21 Apr 2008

interesting, your change is what is already in the MAIN branch, it wasn't in the 4.2 branch - I've commited it thanks smile

-- SvenDowideit - 22 Apr 2008

ItemTemplate
Summary Missuse of sort and loops
ReportedBy TWiki:Main.KlausEthgen
Codebase 4.1.2, 4.2.0
SVN Range TWiki-5.0.0, Tue, 15 Apr 2008, build 16676
AppliesTo Engine
Component

Priority Low
CurrentState Closed
WaitingFor

Checkins TWikirev:16708 TWikirev:16709
TargetRelease patch
ReleasedIn 4.2.1
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r6 - 2008-08-04 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback