[Cpan-forum-commit] rev 343 - in trunk: . lib/CPAN

svn at pti.co.il svn at pti.co.il
Tue Aug 14 11:34:35 EEST 2007


Author: gabor
Date: 2007-08-14 11:34:35 +0300 (Tue, 14 Aug 2007)
New Revision: 343

Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
Log:
eliminate undefs and duplicate thread ids to avoid some of the warnings



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4429
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
   + 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4430
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2007-08-14 08:34:23 UTC (rev 342)
+++ trunk/lib/CPAN/Forum.pm	2007-08-14 08:34:35 UTC (rev 343)
@@ -745,7 +745,15 @@
     my ($self, $it) = @_;
     
     my @resp;
-    my @threads = map {$_->thread} @$it;
+
+    # eliminate undefs and duplicates (TODO: I don't know why are there such values)
+    my %seen;
+    foreach my $p (@$it) {
+        next if not defined $p->thread;
+        $seen{$p->thread}++;
+    }
+    my @threads = keys %seen;
+
     my $threads = CPAN::Forum::DB::Posts->count_threads(@threads); #SQL
     
     foreach my $post (@$it) {



More information about the Cpan-forum-commit mailing list