In perl.git, the branch sprout/carp-strval has been updated <https://perl5.git.perl.org/perl.git/commitdiff/ce796354483847023b2bf19c360d1d5e4aeff094?hp=1c8877803b068ad3fba7f7cae55fd6dac8f20a25>
discards 1c8877803b068ad3fba7f7cae55fd6dac8f20a25 (commit) - Log ----------------------------------------------------------------- commit ce796354483847023b2bf19c360d1d5e4aeff094 Author: Father Chrysostomos <spr...@cpan.org> Date: Mon Feb 26 01:23:53 2018 -0800 Carp: Avoid run-time mods; StrVal workarounds Carp needs to avoid loading modules while reporting errors, because it may be invoked via $SIG{__DIE__} after a syntax error, when BEGIN blocks are forbidden. Before this commit (as of v5.27.8-360-gc99363a) it was doing just that for reference arguments within stack traces. That means we either need to load overload.pm at start-up so that overload::StrVal is already available, or avoid overload::StrVal altogether. It turns out that various versions of overload::StrVal have their own problems that prevent Carp from using them (out- lined in the comments added to Carp.pm and also described at <https://rt.perl.org/Ticket/Display.html?id=132902#txn-1535564>). So we now follow two approaches: If overloading.pm is available, use that; otherwise, use a hideous workaround inspired by ancient imple- entations of overload::StrVal and Scalar::Util::blessed, while avoid- ing the bugs in those old versions. ----------------------------------------------------------------------- Summary of changes: dist/Carp/lib/Carp.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm index 5c741e9d72..6bd8fe6822 100644 --- a/dist/Carp/lib/Carp.pm +++ b/dist/Carp/lib/Carp.pm @@ -186,8 +186,8 @@ BEGIN { # This test seeks to see if it has been set up. "((" post- # dates overloading.pm, so we can skip it. return "$_[0]" unless _mycan($pack, "()"); - # Even at this point, the invocant may not be blessed, so check - # for that. + # Even at this point, the invocant may not be blessed, so + # check for that. return "$_[0]" if not _blessed($_[0]); bless $_[0], "Carp"; my $str = "$_[0]"; -- Perl5 Master Repository