develooper Front page | perl.perl5.porters | Postings from February 2018

[perl #132902] Blead Breaks CPAN: Class::Std

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
February 26, 2018 07:58
Subject:
[perl #132902] Blead Breaks CPAN: Class::Std
Message ID:
rt-4.0.24-27870-1519631878-1170.132902-15-0@perl.org
On Sun, 25 Feb 2018 23:50:45 -0800, sprout wrote:
> Now, for perl 5.8.1 to 5.10.0, we have (1) an overload::StrVal that
> loads Scalar::Util at run time, and (2) an overload::Overloaded which
> for Carp is unusable, since it calls ->can.
> 
> Either we go ahead and load Scalar::Util when loading Carp--which I
> don’t like, but I can be persuaded--, or we avoid overload::StrVal and
> do it the hard way, writing a pure-Perl StrVal.
> 
> For Perl 5.8.0 (yes, I think we should support 5.8.0 still),
> overload::StrVal has the worst implementation yet.  It unconditionally
> blesses any ref passed to it, which may well cause real problems.  Use
> of overload::StrVal isn’t all that common, compared to Carp.  Carp
> will make it common and start blessing people’s references left and
> right when generating a stack trace.  Avoid this old StrVal at all
> costs!

To make things worse, the old pure-Perl Scalar::Util::refaddr also unconditionally blesses references.  It looks almost the same as the old StrVal, so it was probably copied, pasted and tweaked.  That means if we were to use overload::StrVal from 5.8.1 to 5.10.0 (which uses refaddr) we would have to make sure the XS Scalar::Util was loaded.  That’s getting too complicated.

> It looks as though the simplest approach to all this is:
> - For 5.10.1+, use overloading.pm.
> - For 5.10.0-, give Carp its own pure-Perl StrVal.

All the more necessary, considering what I just discovered about refaddr.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: resolved
https://rt.perl.org/Ticket/Display.html?id=132902

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About