Due to historic reasons, LeiQuery.pm gets loaded with LEI.pm and
-clone depends on LEI.  So delay loading any DBI-dependent
modules until querying is actually required.
---
 lib/PublicInbox/LeiQuery.pm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index 3337e5d4..26cfb3fd 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -4,9 +4,7 @@
 # handles "lei q" command and provides internals for
 # several other sub-commands (up, lcat, ...)
 package PublicInbox::LeiQuery;
-use strict;
-use v5.10.1;
-use PublicInbox::OverIdx;
+use v5.12;
 
 sub prep_ext { # externals_each callback
        my ($lxs, $exclude, $loc) = @_;
@@ -18,6 +16,7 @@ sub _start_query { # used by "lei q" and "lei up"
        require PublicInbox::LeiOverview;
        PublicInbox::LeiOverview->new($self) or return;
        my $opt = $self->{opt};
+       require PublicInbox::OverIdx; # loads DBI
        PublicInbox::OverIdx::fork_ok($opt);
        my ($xj, $mj) = split(/,/, $opt->{jobs} // '');
        (defined($xj) && $xj ne '' && $xj !~ /\A[1-9][0-9]*\z/) and

Reply via email to