]> Sergey Matveev's repositories - public-inbox.git/commitdiff
wwwlisting: use first successfully loaded JSON module
authorEric Wong <e@yhbt.net>
Sat, 21 Mar 2020 01:10:33 +0000 (01:10 +0000)
committerEric Wong <e@yhbt.net>
Sat, 21 Mar 2020 05:43:52 +0000 (05:43 +0000)
And not the last...

I only noticed this since JSON::PP::Boolean was spewing
redefinition warnings via overload.pm

Fixes: 8fb8fc52420ef669 ("wwwlisting: avoid lazy loading JSON module")
lib/PublicInbox/WwwListing.pm

index 33cb0ace075016638227cbcce55e659d033afe3f..42a0c0d801a60c652b476b61060a8e9a76043260 100644 (file)
@@ -20,7 +20,7 @@ if (eval { require IO::Compress::Gzip }) {
        for my $mod (qw(JSON::MaybeXS JSON JSON::PP)) {
                eval "require $mod" or next;
                # ->ascii encodes non-ASCII to "\uXXXX"
-               $json = $mod->new->ascii(1);
+               $json = $mod->new->ascii(1) and last;
        }
 }