X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDumpvalue.pm;h=c9b1acafebb8b9b41a166f81d99c8543ff6ae9df;hb=bb2cbcd1ec679f28ec7f1a4f685707a368d32502;hp=c8282cfbd5d4bec1759bda50fecbf286952e9626;hpb=b75c8c73cd7f3c92a16e03fb046f4e2a99363bc7;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Dumpvalue.pm b/lib/Dumpvalue.pm index c8282cf..c9b1aca 100644 --- a/lib/Dumpvalue.pm +++ b/lib/Dumpvalue.pm @@ -1,9 +1,10 @@ -use 5.005_64; # for (defined ref) and $#$v and our +use 5.006_001; # for (defined ref) and $#$v and our package Dumpvalue; use strict; -our $VERSION = '1.00'; +our $VERSION = '1.10'; our(%address, $stab, @stab, %stab, %subs); +# documentation nits, handle complex data structures better by chromatic # translate control chars to ^X - Randal Schwartz # Modifications to print types by Peter Gordon v1.0 @@ -428,7 +429,14 @@ EOP sub scalarUsage { my $self = shift; - my $size = length($_[0]); + my $size; + if (UNIVERSAL::isa($_[0], 'ARRAY')) { + $size = $self->arrayUsage($_[0]); + } elsif (UNIVERSAL::isa($_[0], 'HASH')) { + $size = $self->hashUsage($_[0]); + } elsif (!ref($_[0])) { + $size = length($_[0]); + } $self->{TotalStrings} += $size; $self->{Strings}++; $size; @@ -495,7 +503,7 @@ A new dumper is created by a call Recognized options: -=over +=over 4 =item C, C @@ -511,28 +519,28 @@ may be printed on one line. Whether to print contents of globs. -=item C +=item C Dump arrays holding contents of debugged files. -=item C +=item C Dump symbol tables of packages. -=item C +=item C Dump contents of "reused" addresses. -=item C, C, C +=item C, C, C Change style of string dump. Default value of C is C, one can enable either double-quotish dump, or single-quotish by setting it to C<"> or C<'>. By default, characters with high bit set are printed -I. +I. If C is set, they will be quoted. -=item C +=item C -I rudimentally per-package memory usage dump. If set, +rudimentally per-package memory usage dump. If set, C calculates total size of strings in variables in the package. =item unctrl @@ -563,7 +571,7 @@ method and set() method (which accept multiple arguments). =head2 Methods -=over +=over 4 =item dumpValue