about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiInput.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-22 07:53:59 +0000
committerEric Wong <e@80x24.org>2021-03-23 00:07:12 +0000
commitd4b8980b9d2305c3004ff076a83006cc20502e56 (patch)
tree9fc5aca5d117d04a4c7b7ff2f5b9a818f3b9372c /lib/PublicInbox/LeiInput.pm
parentc61dc9e3b1d4e8fb0035461dced3f46853535e80 (diff)
downloadpublic-inbox-d4b8980b9d2305c3004ff076a83006cc20502e56.tar.gz
mbox_reader: add ->reads method to avoid nonsensical formats
Relying on UNIVERSAL::can may cause internal helper methods
to be used, which can lead to failures or nonsensical results.
Diffstat (limited to 'lib/PublicInbox/LeiInput.pm')
-rw-r--r--lib/PublicInbox/LeiInput.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm
index 89585a52..776b3151 100644
--- a/lib/PublicInbox/LeiInput.pm
+++ b/lib/PublicInbox/LeiInput.pm
@@ -18,7 +18,7 @@ sub check_input_format ($;$) {
         require PublicInbox::MboxReader;
         return 1 if $fmt eq 'eml';
         # XXX: should this handle {gz,bz2,xz}? that's currently in LeiToMail
-        PublicInbox::MboxReader->can($fmt) or
+        PublicInbox::MboxReader->reads($fmt) or
                 return $lei->fail("--$opt_key=$fmt unrecognized");
         1;
 }
@@ -53,7 +53,7 @@ sub prepare_inputs {
                         if (-f $input_path) {
                                 require PublicInbox::MboxLock;
                                 require PublicInbox::MboxReader;
-                                PublicInbox::MboxReader->can($ifmt) or return
+                                PublicInbox::MboxReader->reads($ifmt) or return
                                         $lei->fail("$ifmt not supported");
                         } elsif (-d _) {
                                 require PublicInbox::MdirReader;