From d87c3bf791e5222ee0d1ef2d23689ac9dffe63a5 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 19 Sep 2007 14:20:37 +0000 Subject: [PATCH] =?utf8?q?Das=20Modul=20"Data::Dumper"=20hat=20die=20Eigen?= =?utf8?q?heit,=20dass=20es=20den=20Iterator=20von=20gedumpten=20Hashes=20?= =?utf8?q?nicht=20zur=C3=BCcksetzt=20bzw.=20ihn=20nicht=20bis=20zum=20Ende?= =?utf8?q?=20ausliest,=20wenn=20"Sortkeys"=20wahr=20ist.=20Das=20hat=20zur?= =?utf8?q?=20Folge,=20dass=20der=20folgende=20Aufrufe=20von=20"each"=20f?= =?utf8?q?=C3=BCr=20dieses=20Hash=20sofort=20beendet=20wird.=20Also=20muss?= =?utf8?q?=20der=20Iterator=20manuell=20zur=C3=BCckgesetzt=20werden.=20Sie?= =?utf8?q?he=20auch=20die=20Diskussion=20in=20"perldoc=20-f=20each".?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/LXDebug.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index 6a8ca5af5..185297ba0 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -131,6 +131,14 @@ sub dump { my $dumper = Data::Dumper->new([$variable]); $dumper->Sortkeys(1); $self->message($level, "dumping ${name}:\n" . $dumper->Dump()); + + # Data::Dumper does not reset the iterator belonging to this hash + # if 'Sortkeys' is true. Therefore clear the iterator manually. + # See "perldoc -f each". + if ($variable && ('HASH' eq ref $variable)) { + keys %{ $variable }; + } + } else { $self->message($level, "dumping ${name}: Data::Dumper not available; " -- 2.20.1