]> Sergey Matveev's repositories - public-inbox.git/commitdiff
wwwatomstream: move {emit_header} field to $self
authorEric Wong <e@yhbt.net>
Sat, 18 Apr 2020 03:38:51 +0000 (03:38 +0000)
committerEric Wong <e@yhbt.net>
Sun, 19 Apr 2020 08:51:26 +0000 (08:51 +0000)
There's no need to pollute the cross-package $ctx with it.

Documentation/mknews.perl
lib/PublicInbox/WwwAtomStream.pm

index adb83832d75d49f05f52c69fb1e21ce7593cfdd3..a9dede004aee78b5b37fa5e72684b8760e44d9ab 100755 (executable)
@@ -127,7 +127,7 @@ sub atom_start {
        require PublicInbox::WwwAtomStream;
        # WwwAtomStream stats this dir for mtime
        my $astream = PublicInbox::WwwAtomStream->new($ctx);
-       delete $ctx->{emit_header};
+       delete $astream->{emit_header};
        my $ibx = $ctx->{-inbox};
        my $title = PublicInbox::WwwAtomStream::title_tag($ibx->description);
        my $updated = PublicInbox::WwwAtomStream::feed_updated(gmtime($mtime));
index aa917ed84f000d117fb9d0582627916e936c9b00..c3fbb1a7cef589479f55860474390a7a3b3e5687 100644 (file)
@@ -20,9 +20,8 @@ sub close {}
 
 sub new {
        my ($class, $ctx, $cb) = @_;
-       $ctx->{emit_header} = 1;
        $ctx->{feed_base_url} = $ctx->{-inbox}->base_url($ctx->{env});
-       bless { cb => $cb || \&close, ctx => $ctx }, $class;
+       bless { cb => $cb || \&close, ctx => $ctx, emit_header => 1 }, $class;
 }
 
 sub response {
@@ -130,7 +129,7 @@ sub feed_entry {
        $email = ascii_html($email);
 
        my $s = '';
-       if (delete $ctx->{emit_header}) {
+       if (delete $self->{emit_header}) {
                $s .= atom_header($ctx, $title);
        }
        $s .= "<entry><author><name>$name</name><email>$email</email>" .