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 F286D1F5A1 for ; Tue, 31 Dec 2019 10:30:13 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/5] cgit: type declaration for PublicInbox::Git Date: Tue, 31 Dec 2019 10:30:13 +0000 Message-Id: <20191231103013.9133-6-e@80x24.org> In-Reply-To: <20191231103013.9133-1-e@80x24.org> References: <20191231103013.9133-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: AFAIK this doesn't do anything for Perl internally since PublicInbox::Git doesn't "use fields", but it makes it easier for humans readers to follow and ensure we're not passing unblessed or non-ref scalars to PublicInbox::GitHTTPBackend::serve. --- lib/PublicInbox/Cgit.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm index ab4065bd..36239438 100644 --- a/lib/PublicInbox/Cgit.pm +++ b/lib/PublicInbox/Cgit.pm @@ -8,6 +8,7 @@ package PublicInbox::Cgit; use strict; use PublicInbox::GitHTTPBackend; +use PublicInbox::Git; # not bothering with Exporter for a one-off *r = *PublicInbox::GitHTTPBackend::r; *input_prepare = *PublicInbox::GitHTTPBackend::input_prepare; @@ -109,7 +110,7 @@ sub call { # handle requests without spawning cgit iff possible: if ($path_info =~ m!\A/(.+?)/($PublicInbox::GitHTTPBackend::ANY)\z!ox) { my ($nick, $path) = ($1, $2); - if (my $git = $self->{"\0$nick"}) { + if (my PublicInbox::Git $git = $self->{"\0$nick"}) { return serve($env, $git, $path); } } elsif ($path_info =~ m!$self->{static}! &&