Committer: gprochaev
LJSUP-7803. Not working Community DirectoryU trunk/cgi-bin/LJ/Browse.pm
Modified: trunk/cgi-bin/LJ/Browse.pm =================================================================== --- trunk/cgi-bin/LJ/Browse.pm 2011-02-01 04:52:37 UTC (rev 18168) +++ trunk/cgi-bin/LJ/Browse.pm 2011-02-01 04:53:16 UTC (rev 18169) @@ -24,25 +24,24 @@ my %opts = @_; - my $self = bless { - # arguments - catid => delete $opts{catid}, - }; + my $catid = delete $opts{catid}; + croak("need to supply catid") unless defined $catid; - croak("need to supply catid") unless defined $self->{catid}; - croak("unknown parameters: " . join(", ", keys %opts)) if %opts; # do we have a singleton for this category? { - my $catid = $self->{catid}; - return $singletons{$catid} if exists $singletons{$catid}; - - # save the singleton if it doesn't exist - $singletons{$catid} = $self; + my $cached = $singletons{$catid}; + return $cached if $cached; } + my $self = bless {} => $class; + $self->{catid} = $catid; + + # save the singleton if it doesn't exist + $singletons{$catid} = $self; + return $self; } *instance = \&new; @@ -647,6 +646,7 @@ } # weird, catids that we couldn't find in memcache or db? + $_->{_loaded_row} = 1 foreach values %need; #warn "unknown category: " . join(",", keys %need) if %need; # now memcache and request cache are both updated, we're done