Subject: | Test failed due to invalid using of each() |
Test failed with following error:
Use of each() on hash after insertion without resetting hash iterator results in undefined behavior, Perl interpreter: 0x1eb9010 at /builddir/build/BUILD/Devel-Profiler-0.04/blib/lib/Devel/Profiler.pm line 154.
# Failed test 'checking tree'
# at /builddir/build/BUILD/Devel-Profiler-0.04/blib/lib/Devel/Profiler/Test.pm line 65.
# got: 'main::NONCONSTANT1
# '
# expected: 'main::NONCONSTANT1
# main::NONCONSTANT2
# main::NONCONSTANT3
# '
# Looks like you failed 1 test of 2.
t/07constants.t ...
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
Possible patch is attached.
Subject: | Do-not-use-each-on-hash-after-insertion.patch |
diff -up Devel-Profiler-0.04/lib/Devel/Profiler.pm.orig Devel-Profiler-0.04/lib/Devel/Profiler.pm
--- Devel-Profiler-0.04/lib/Devel/Profiler.pm.orig 2015-05-04 14:21:19.656372129 +0200
+++ Devel-Profiler-0.04/lib/Devel/Profiler.pm 2015-05-04 15:46:34.250607264 +0200
@@ -137,7 +137,8 @@ sub scan {
if DEBUG;
no strict 'refs'; # need symbolic references to diddle symbol tables
- while (($sym, $glob) = each %{$pkg}) {
+ foreach $sym (keys %{${pkg}}) {
+ $glob = ${${pkg}}{$sym};
next if $sym eq $pkg; # self ref? (%main::main::main::...)
# found a subpackage?