B::Deparse would incorrectly deparse code like C<$hash{warn()}> or C<$hash{+warn}> as C<$hash{warn}>, which isn't the same thing at all. The patch below should fix this problem. Thanks to Richard Soderberg for telling me about this problem. .robin. PS. I hope the patch isn't mangled by this mailer. Does anyone have a port of mutt to darwin? --- ext/B/B/Deparse.pm.one Mon Jul 2 21:34:06 2001 +++ ext/B/B/Deparse.pm Mon Jul 2 21:49:08 2001 @@ -2668,6 +2668,16 @@ # expression would be parenthesized as well.] # $idx =~ s/^\((.*)\)$/$1/ if $self->{'parens'}; + + # Hash-element braces will autoquote a bareword inside themselves. + # We need to make sure that C<$hash{warn()}> doesn't come out as + # C<$hash{warn}>, which has a quite different meaning. Currently + # B::Deparse will always quote strings, even if the string was a + # bareword in the original (i.e. the OPpCONST_BARE flag is ignored + # for constant strings.) So we can cheat slightly here - if we see + # a bareword, we know that it is supposed to be a function call. + # + $idx =~ s/^([A-Za-z_]\w*)$/$1()/; return "\$" . $array . $left . $idx . $right; }Thread Next