From 4b313dc74bc9bb84a542b7ec920cdb92879e7523 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 20 Jun 2016 00:57:16 +0000 Subject: feed: various object-orientation cleanups Favor Inbox objects as our primary source of truth to simplify our code. This increases our coupling with PSGI to make it easier to write tests in the future. A lot of this code was originally designed to be usable standalone without PSGI or CGI at all; but that might increase development effort. --- lib/PublicInbox/Mbox.pm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lib/PublicInbox/Mbox.pm') diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 0258d8c7..63ec605f 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -107,7 +107,6 @@ EOF package PublicInbox::MboxGz; use strict; use warnings; -use PublicInbox::MID qw(mid2path); sub new { my ($class, $ctx, $cb) = @_; @@ -135,15 +134,12 @@ sub getline { my ($self) = @_; my $res; my $ctx = $self->{ctx}; - my $git = $ctx->{git}; + my $ibx = $ctx->{-inbox}; my $gz = $self->{gz}; do { while (defined(my $smsg = shift @{$self->{msgs}})) { - my $msg = eval { - my $p = 'HEAD:'.mid2path($smsg->mid); - Email::Simple->new($git->cat_file($p)); - }; - $msg or next; + my $msg = eval { $ibx->msg_by_mid($smsg->mid) } or next; + $msg = Email::Simple->new($msg); $gz->write(PublicInbox::Mbox::msg_str($ctx, $msg)); my $ret = _flush_buf($self); return $ret if $ret; -- cgit v1.2.3-24-ge0c7