]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Feed.pm
view: refactor $state as a hash
[public-inbox.git] / lib / PublicInbox / Feed.pm
index f4d19e0208d1355101e8e03cd521b99b6c568b8f..969fc1107652ad8b74a966eee17d9d770e580844 100644 (file)
@@ -89,7 +89,12 @@ sub emit_html_index {
        $srch and $topics = [ [], {} ];
        my (undef, $last) = each_recent_blob($ctx, sub {
                my ($path, $commit, $ts, $u, $subj) = @_;
-               $state ||= [ undef, {}, $commit, 0 ];
+               $state ||= {
+                       ctx => $ctx,
+                       seen => {},
+                       first_commit => $commit,
+                       anchor_idx => 0,
+               };
 
                if ($srch) {
                        add_topic($git, $srch, $topics, $path, $ts, $u, $subj);
@@ -119,9 +124,8 @@ sub nav_footer {
        my $old_r = $cgi->param('r');
        my $head = '    ';
        my $next = '    ';
-       # $state = [ undef, {}, $first_commit, $last_anchor ];
-       my $first = $state->[2];
-       my $anchor = $state->[3];
+       my $first = $state->{first_commit};
+       my $anchor = $state->{anchor_idx};
 
        if ($last) {
                $next = qq!<a\nhref="?r=$last">next</a>!;