From: Rafael Garcia-Suarez Date: Thu, 27 Sep 2001 22:34:32 +0000 (+0200) Subject: Re: [BUG] B::Terse can't handle constant scalar refs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d333a2173e786c391c48ee4f5f7df078b91e90b1;p=p5sagit%2Fp5-mst-13.2.git Re: [BUG] B::Terse can't handle constant scalar refs Message-ID: <20010927223432.A1485@rafael> p4raw-id: //depot/perl@12250 --- diff --git a/ext/B/B/Terse.pm b/ext/B/B/Terse.pm index 52f0549..4c31a66 100644 --- a/ext/B/B/Terse.pm +++ b/ext/B/B/Terse.pm @@ -118,6 +118,27 @@ sub B::NV::terse { printf "%s (0x%lx) %s\n", class($sv), $$sv, $sv->NV; } +sub B::RV::terse { + my ($rv, $level) = @_; + print indent($level); + printf "%s (0x%lx) %s\n", class($rv), $$rv, printref($rv); +} + +sub printref { + my $rv = shift; + my $rcl = class($rv->RV); + if ($rcl eq 'PV') { + return "\\" . cstring($rv->RV->$rcl); + } elsif ($rcl eq 'NV') { + return "\\" . $rv->RV->$rcl; + } elsif ($rcl eq 'IV') { + return sprintf "\\%" . ($rv->RV->FLAGS & SVf_IVisUV ? "u" : "d"), + $rv->RV->int_value; + } elsif ($rcl eq 'RV') { + return "\\" . printref($rv->RV); + } +} + sub B::NULL::terse { my ($sv, $level) = @_; print indent($level);