From 17b681bb6fc746aa646c0da346e6d369e3c50700 Mon Sep 17 00:00:00 2001 From: bbrtj Date: Sat, 22 Jun 2024 18:07:19 +0200 Subject: [PATCH] Avoid try block just for checking $object->isa --- lib/HTTP/Message/PSGI.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/HTTP/Message/PSGI.pm b/lib/HTTP/Message/PSGI.pm index f2fce9cf..f8cb6e83 100644 --- a/lib/HTTP/Message/PSGI.pm +++ b/lib/HTTP/Message/PSGI.pm @@ -8,7 +8,7 @@ use Carp (); use HTTP::Status qw(status_message); use URI::Escape (); use Plack::Util; -use Try::Tiny; +use Scalar::Util (); my $TRUE = (1 == 1); my $FALSE = !$TRUE; @@ -16,9 +16,8 @@ my $FALSE = !$TRUE; sub req_to_psgi { my $req = shift; - unless (try { $req->isa('HTTP::Request') }) { - Carp::croak("Request is not HTTP::Request: $req"); - } + Carp::croak("Request is not HTTP::Request: $req") + unless Scalar::Util::blessed $req && $req->isa('HTTP::Request'); # from HTTP::Request::AsCGI my $host = $req->header('Host');