On Thu, 21 Dec 2017 09:52:59 GMT, DaTa wrote: > > This is a bug report for perl from data@cpan.org, > generated with the help of perlbug 1.40 running under perl 5.26.1. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > Hi, > > i've run accross a segmentation fault with the following script: > > package Clock; > use 5.010; > use strict; > > use overload > '+' => \&add_time, > '-' => \&sub_time, > 'eq' => \&equals_to, > '""' => \&to_string; > > sub equals_to{ $_[0] eq $_[1] } > sub to_string { sprintf '%02d:%02d', $_[0][0] // 0, $_[0][1] // 0; } > sub new { bless( $_[1], $_[0] ); } > > package main; > Clock->new([8,0]) eq "08:00" > __END__ > > The SIGSEGV goes away when I change equals_to to: > > sub equals_to{ $_[0]->to_string eq $_[1] } > > bye, > > Danijel > Confirmed. Note that the problem is older than the perl-5.010 needed to make use of the '//' operator in sub to_string(). If we switch those to '||', we can reproduce the segfault going back at least to perl 5.6. See attached. Thank you very much. -- James E Keenan (jkeenan@cpan.org) --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=132638Thread Next