From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 59DA81F619; Sat, 21 Mar 2020 05:24:32 +0000 (UTC) Date: Sat, 21 Mar 2020 05:24:32 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH v2] t/www_listing: avoid 'once' warnings Message-ID: <20200321052432.GA11567@dcvr> References: <20200321011034.3731-1-e@yhbt.net> <20200321011034.3731-3-e@yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200321011034.3731-3-e@yhbt.net> List-Id: We reach into the WwwListing package directly to retrieve that JSON encoder/decoder object, and we can't rely on `use' since WwwListing loading may fail if Plack is missing. --- *sigh* v1 was wrong :x t/www_listing.t | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/www_listing.t b/t/www_listing.t index 39c19577..9230329c 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -9,8 +9,10 @@ use PublicInbox::TestCommon; require_mods(qw(URI::Escape Plack::Builder Digest::SHA IO::Compress::Gzip IO::Uncompress::Gunzip HTTP::Tiny)); require PublicInbox::WwwListing; -my $json = $PublicInbox::WwwListing::json or - plan skip_all => "JSON module missing"; +my $json = do { + no warnings 'once'; + $PublicInbox::WwwListing::json; +} or plan skip_all => "JSON module missing"; use_ok 'PublicInbox::Git';