]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
clone: allow running without DBI / DBD::SQLite
authorEric Wong <e@80x24.org>
Thu, 27 Jul 2023 21:18:55 +0000 (21:18 +0000)
committerEric Wong <e@80x24.org>
Thu, 27 Jul 2023 23:23:08 +0000 (23:23 +0000)
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

index 3337e5d463ae5b9a0b1c728957bb4c7f066aaf32..26cfb3fdc7700f35b15744d241e980cdfa2eb95b 100644 (file)
@@ -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