[Cpan-forum-commit] rev 342 - in trunk: . lib/CPAN lib/CPAN/Forum/DB

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


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

Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
   trunk/lib/CPAN/Forum/DB/Posts.pm
Log:
eliminate several warnings about undef values



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

Modified: trunk/lib/CPAN/Forum/DB/Posts.pm
===================================================================
--- trunk/lib/CPAN/Forum/DB/Posts.pm	2007-08-14 08:34:09 UTC (rev 341)
+++ trunk/lib/CPAN/Forum/DB/Posts.pm	2007-08-14 08:34:23 UTC (rev 342)
@@ -161,7 +161,7 @@
     return {} if not @thread_ids;
     # TODO check if they are all numbers?
 
-    #Carp::cluck(Data::Dumper->Dump([\@thread_ids],['thread_ids']));
+    $CPAN::Forum::logger->debug(Data::Dumper->Dump([\@thread_ids], ['thread_ids']));
     my $ids = join ",", @thread_ids;
     my $sql = "SELECT thread, COUNT(*) cnt FROM posts WHERE thread in ($ids) GROUP BY thread";
     return $self->_selectall_hashref($sql, 'thread');

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2007-08-14 08:34:09 UTC (rev 341)
+++ trunk/lib/CPAN/Forum.pm	2007-08-14 08:34:23 UTC (rev 342)
@@ -749,8 +749,11 @@
     my $threads = CPAN::Forum::DB::Posts->count_threads(@threads); #SQL
     
     foreach my $post (@$it) {
+        #$self->log->debug(Data::Dumper->Dump([$post], ['post']));
+        $self->log->debug("id=" . $post->id);
 #warn "called for each post";
-        my $thread_count = $threads->{$post->thread}{cnt};
+        my $thread = $post->thread;
+        my $thread_count = ($thread and $threads->{$thread}) ? $threads->{$thread}{cnt} : 0;
         push @resp, {
             subject      => _subject_escape($post->subject), 
             id           => $post->id, 



More information about the Cpan-forum-commit mailing list