Skip to content

Commit

Permalink
use ref to avoid calling overloaded methods. Fix #697
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Sep 14, 2023
1 parent db2a055 commit 5a52015
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Plack/Middleware/StackTrace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ sub call {
$trace = $caught_trace if $caught_trace;
}

if ($trace && ($caught || ($self->force && ref $res eq 'ARRAY' && $res->[0] == 500)) ) {
# Use ref $trace to avoid calling as_string twice when it's not necessary
if (ref $trace && ($caught || ($self->force && ref $res eq 'ARRAY' && $res->[0] == 500)) ) {
my $text = $trace->as_string;
my $html = $trace->as_html;
$env->{'plack.stacktrace.text'} = $text;
Expand Down

0 comments on commit 5a52015

Please sign in to comment.