You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ($trace && some_other_condition()) {
$trace->as_string;
}
this code looks as if $trace->as_string doesn't get called if some_other_condition() is false, or just once if the condition is true. But actually, the first if ($trace) triggers as_string due to the string overloading, and how perl's overload automatically uses the string value for boolean check. As a result, $trace->as_string is called one extra time which could cause some slow down in the app when the stacktrace is huge.
Consider adding bool => sub { 1 } to the overload list to avoid this. I've worked around in the caller code to change the if statement to if (ref $trace) for now.
The text was updated successfully, but these errors were encountered:
re plack/Plack#697
this code looks as if
$trace->as_string
doesn't get called ifsome_other_condition()
is false, or just once if the condition is true. But actually, the firstif ($trace)
triggersas_string
due to the string overloading, and how perl's overload automatically uses the string value for boolean check. As a result,$trace->as_string
is called one extra time which could cause some slow down in the app when the stacktrace is huge.Consider adding
bool => sub { 1 }
to the overload list to avoid this. I've worked around in the caller code to change the if statement toif (ref $trace)
for now.The text was updated successfully, but these errors were encountered: