summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2013-03-24 11:48:12 +0100
committerYves Orton <demerphq@gmail.com>2013-03-24 11:50:18 +0100
commite1a7ec8d453649a65aea34af90c3042a5137191e (patch)
treec865e78cabc2b4ec7436679e51e55609c6d397cb /dump.c
parentff20b672a2557d27fcb80d597224fa0c24e43f73 (diff)
downloadperl-e1a7ec8d453649a65aea34af90c3042a5137191e.tar.gz
improve how Devel::Peek::Dump handles iterator information
* If the hash is not OOK omit any iterator status information instead of showing -1/NULL * If the hash is OOK then add the RAND value from the iterator and if the LASTRAND is not the same show it too * Tweak tests to test the above.
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/dump.c b/dump.c
index fcc63fcd8f..dd0e30577a 100644
--- a/dump.c
+++ b/dump.c
@@ -1801,8 +1801,16 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvUSEDKEYS(sv));
Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)HvFILL(sv));
Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)HvMAX(sv));
- Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER_get(sv));
- Perl_dump_indent(aTHX_ level, file, " EITER = 0x%"UVxf"\n", PTR2UV(HvEITER_get(sv)));
+ if (SvOOK(sv)) {
+ Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER_get(sv));
+ Perl_dump_indent(aTHX_ level, file, " EITER = 0x%"UVxf"\n", PTR2UV(HvEITER_get(sv)));
+ Perl_dump_indent(aTHX_ level, file, " RAND = 0x%"UVxf, (UV)HvRAND_get(sv));
+ if (HvRAND_get(sv) != HvLASTRAND_get(sv) && HvRITER_get(sv) != -1 ) {
+ PerlIO_printf(file, " (LAST = 0x%"UVxf")\n", (UV)HvLASTRAND_get(sv));
+ } else {
+ PerlIO_putc(file, '\n');
+ }
+ }
{
MAGIC * const mg = mg_find(sv, PERL_MAGIC_symtab);
if (mg && mg->mg_obj) {