]> Sergey Matveev's repositories - public-inbox.git/commitdiff
qspawn: import Scalar::Util::blessed properly
authorEric Wong <e@80x24.org>
Fri, 13 Jan 2023 10:35:48 +0000 (10:35 +0000)
committerEric Wong <e@80x24.org>
Fri, 13 Jan 2023 19:14:21 +0000 (19:14 +0000)
Scalar::Util may not be loaded by other modules in the future.

lib/PublicInbox/Qspawn.pm

index c2d8fd732c7a0ddf6696f7bd6316e0536dc0776f..0044c1f6b818683497120574f917cac8b642de77 100644 (file)
@@ -28,6 +28,7 @@ package PublicInbox::Qspawn;
 use v5.12;
 use PublicInbox::Spawn qw(popen_rd);
 use PublicInbox::GzipFilter;
+use Scalar::Util qw(blessed);
 
 # n.b.: we get EAGAIN with public-inbox-httpd, and EINTR on other PSGI servers
 use Errno qw(EAGAIN EINTR);
@@ -234,8 +235,9 @@ sub psgi_return_init_cb { # this may be PublicInbox::HTTPD::Async {cb}
        my $r = rd_hdr($self) or return;
        my $env = $self->{psgi_env};
        my $filter;
-       if (ref($r) eq 'ARRAY' && Scalar::Util::blessed($r->[2]) &&
-                       $r->[2]->can('attach')) {
+
+       # this is for RepoAtom since that can fire after parse_cgi_headers
+       if (ref($r) eq 'ARRAY' && blessed($r->[2]) && $r->[2]->can('attach')) {
                $filter = pop @$r;
        }
        $filter //= delete($env->{'qspawn.filter'}) // (ref($r) eq 'ARRAY' ?