- my $buf = do {
- if (my $middle = $self->{cb}) {
- my $smsg = $middle->($self);
- feed_entry($self, $smsg) if $smsg;
- }
- } // (delete($self->{cb}) ? '</feed>' : undef);
-
- # gzf may be GzipFilter, `undef' or `0'
- my $gzf = $self->{gzf} or return $buf;
-
- return $gzf->translate($buf) if defined $buf;
- $self->{gzf} = 0; # next call to ->getline returns $buf (== undef)
- $gzf->translate(undef);
+ my $cb = $self->{cb} or return;
+ while (my $smsg = $cb->($self)) {
+ my $eml = $self->{ibx}->smsg_eml($smsg) or next;
+ return $self->translate(feed_entry($self, $smsg, $eml));
+ }
+ delete $self->{cb};
+ $self->zflush('</feed>');