Enache Adrian wrote: > Perl blesses the reference qr// returns into a hypothetical > "Regexp" package (see pp_qr() - pp_hot.c:1140) . It seems that the > only use for this trick is that > $a = qr/ ... /; > ref $a > returns 'Regexp'. This is used by a lot a Perl modules/scripts. > > When the time comes for the qr// to be freed, the code inside > sv_clear() tries to call its DESTROY method - since it is an > object. (sv.c:5261) > DESTROY doesn't exist in the 'Regexp' stash: if the user defined > a UNIVERSAL::AUTOLOAD sub, that will be called instead. > If that AUTOLOAD uses qr//'s, the recursion happens. Thanks for that explanation. > I have 2 ideas to fix that: > > 1) Completely drop the 'Regexp' stash trick. Let $a = qr/../ be > a simple reference. Hack sv_reftype to return "Regexp" if the SV > its argument points to is a 'r'-magical variable. You can try this to see what breaks. From what I can see, some adjustements may be needed in Data::Dumper. However I think this is a cleaner solution than : > 2) Put a dummy DESTROY method in the 'Regexp' stash.Thread Previous | Thread Next