From: Eric Wong Date: Tue, 31 Dec 2019 10:30:13 +0000 (+0000) Subject: cgit: type declaration for PublicInbox::Git X-Git-Tag: v1.3.0~171 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=0a3ead80bc685fcabed9f7dfaae35c74b72cd830;hp=a7d4f457ec2b4531b3aaeb6cef1383bbda5b431a;p=public-inbox.git cgit: type declaration for PublicInbox::Git 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. --- 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}! &&