On Sat, 24 Feb 2018 04:16:48 -0800, demerphq wrote:
> On 24 February 2018 at 12:32, demerphq <deme...@gmail.com> wrote:> > On 24 February 2018 at 03:46, demerphq <deme...@gmail.com> wrote:> >> On 24 February 2018 at 03:44, Zefram <zef...@fysh.org> wrote:> >>> demerphq wrote:> >>>> Thanks, this looks like fallout from a fix I pushed yesterday.> >>>> >>> Confirmed: it bisects to commit> >>> c99363aa273278adcad39f32026629b700f9bbc3> >>> "fix Perl #132828 - dont use overload to bypass overloads". The> >>> relevant> >>> part of Class::Std is overriding UNIVERSAL::can.> >>> >> Which means its Class::Std's fault for not implementing can> >> properly.> >>> >> Nevertheless I will find a fix.> >>> >> Thanks for verifying and the analysis Zefram.> >> > I have created a pull request against Class::Std to fix this.> >> > https://github.com/chorny/Class-Std/pull/2> >> > I also will push a patch to fix this in Carp.pm as well.> > Fixed in 17157c41e6523264e0f5e7d4baa490a1a8f2322b
I don’t like the current state of the code in Carp.pm, but I can’t say I have a better suggestion off the top of my head. I have not thought it through thoroughly yet. Let me just outline my concerns, before I forget them, and later if I have time I might come up with a patch:
if ($in_recurse || do{ local $in_recurse = 1; $pack->can("((") }) {
This will only work on newer perls (5.16+ iirc), since older ones used (), not ((. And I think even current perl allows XS modules to register overloading via just (), without ((. I need to check.
‘can’ is really not the right thing to use. Overriding ‘can’ makes sense in the presence of AUTOLOAD, but since overloading bypassing AUTOLOAD, it should be bypassing ‘can‘ as well. This is why overload.pm implements its own ‘can’. Perhaps overload.pm should be loaded unconditionally when Carp is loaded (it is more lightweight than Carp, after all). Then theoretically one could use overload::Overloaded, but unfortunately old versions have the same ‘can’ bug that will cause the recursion. Maybe calling overload::mycan directly is the solution.
This is a real can of worms.
--
Father Chrysostomos
---
via perlbug: queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=132902