@@ -336,17 +336,16 @@ sub format_arg {
336
336
}
337
337
else
338
338
{
339
- # this particular bit of magic looking code is responsible for disabling overloads
340
- # while we are stringifing arguments, otherwise if an overload calls a Carp sub we
341
- # could end up in infinite recursion, which means we will exhaust the C stack and
342
- # then segfault. Calling Carp obviously should not trigger an untrappable exception
343
- # from Carp itself! - Yves
344
339
if ($pack -> can(" ((" )) {
345
- # this eval is required, or fail the overload test
346
- # in dist/Carp/t/vivify_stash.t, which is really quite weird.
347
- # Even if we never enter this block, the presence of the require
348
- # causes the test to fail. This seems like it might be a bug
349
- # in require. Needs further investigation - Yves
340
+ # Argument is blessed into a class with overloading, and
341
+ # so might have an overloaded stringification. We don't
342
+ # want to risk getting the overloaded stringification,
343
+ # so we need to use overload::StrVal() below. But it's
344
+ # possible that the overload module hasn't been loaded:
345
+ # overload methods can be installed without it. So load
346
+ # the module here. The eval layer here avoids the
347
+ # compile-time effect of require vivifying the target
348
+ # module's stash.
350
349
eval " require overload; 1"
351
350
or return " use overload failed" ;
352
351
}
0 commit comments