about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchMsg.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-25 07:51:04 +0000
committerEric Wong <e@80x24.org>2019-12-28 19:38:23 +0000
commitf2364c5765f0692d2f1e82b61804359a38f3fdfc (patch)
tree2b0507af4558629169cc5ea1e48efd79cb8f015f /lib/PublicInbox/SearchMsg.pm
parentb316f7541ec263fd04ea50530a1d500f43773299 (diff)
downloadpublic-inbox-f2364c5765f0692d2f1e82b61804359a38f3fdfc.tar.gz
This allows callers to pass named (not anonymous) subs.

Update all retry_reopen callers to use this feature, and
fix some places where we failed to use retry_reopen :x
Diffstat (limited to 'lib/PublicInbox/SearchMsg.pm')
-rw-r--r--lib/PublicInbox/SearchMsg.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm
index 53882f73..ea54ba8a 100644
--- a/lib/PublicInbox/SearchMsg.pm
+++ b/lib/PublicInbox/SearchMsg.pm
@@ -92,10 +92,11 @@ sub psgi_cull ($) {
 }
 
 # Only called by PSGI interface, not NNTP
-sub load_doc {
-        my ($class, $doc) = @_;
-        my $self = bless {}, $class;
-        psgi_cull(load_expand($self, $doc));
+sub from_mitem {
+        my ($mitem, $srch) = @_;
+        return $srch->retry_reopen(\&from_mitem, $mitem) if $srch;
+        my $self = bless {}, __PACKAGE__;
+        psgi_cull(load_expand($self, $mitem->get_document));
 }
 
 # :bytes and :lines metadata in RFC 3977