On 9/22/05, Paul Johnson <[EMAIL PROTECTED]> wrote: > On Wed, Sep 21, 2005 at 04:26:27PM +0200, demerphq wrote: > > > And, it doesnt help that something about DC breaks the defined > > operator when dealing with overloaded objects. (yeah, he did say the > > code was alpha quality :-) > > Bug reports, especially those containing small, self contained test > cases, go a long way to helping such problems get solved ;-)
Unfortunately this bug is in the crazy netherworld of perl weirdness, and im not even sure if I know where to start. If you want to see try to run Data::Dump::Streamer 1.14 under DC. It will die horribly in overload.t, yet when run without DC it is fine. overload.t is essentially a test to make sure that DDS never triggers an overloaded method when dumping an object, so every single overloaded operator is overloaded to Carp. The latter behaviour is the first problem that DC triggers, as Carp.pm has code like this in it: sub format_arg { my $arg = shift; if (not defined($arg)) { $arg = 'undef'; } elsif (ref($arg)) { $arg = defined($overload::VERSION) ? overload::StrVal($arg) : "$arg"; } That first defined triggers the overloaded method when run under DC, but doesnt when not. That in itself triggers infinite recursion and the program segfaults. Once the Carp code is patched to be sub format_arg { my $arg = shift; if (ref($arg)) { $arg = defined($overload::VERSION) ? overload::StrVal($arg) : "$arg"; }elsif (not defined($arg)) { $arg = 'undef'; } the infinite recursion goes away, but you start seeing the same error throughout DDS. By eliminating all calls to defined() on possibly overloaded vars the errors go away. (Unfortunately i havent released 1.15 yet so you can see the changes made to 1.14 to make it pass DC testing) Conclusion: DC interferes with the behaviour of the defined function and somehow triggers overloaded methods. Unfortunately DDS is a pretty hairy module that works on a pretty hairy domain (accurately dumping perl data structures is not at all straight forward) so its hard to say what is responsible. Ill do my best to find a minimal example and to prepare patches for Carp.pm so it doesnt have this problem in the future. Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"