summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
Diffstat (limited to 'dist')
-rw-r--r--dist/Data-Dumper/Dumper.pm7
-rw-r--r--dist/Data-Dumper/Dumper.xs7
-rw-r--r--dist/Data-Dumper/t/bugs.t7
3 files changed, 18 insertions, 3 deletions
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index 8018bae523..b4c6f7b037 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -504,7 +504,12 @@ sub _dump {
$sname = $name;
}
else {
- $sname = $s->_dump($name eq 'main::' ? '' : $name, "");
+ $sname = $s->_dump(
+ $name eq 'main::' || $] < 5.007 && $name eq "main::\0"
+ ? ''
+ : $name,
+ "",
+ );
$sname = '{' . $sname . '}';
}
if ($s->{purity}) {
diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 30a9b40e1e..2ad53a15c3 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -918,7 +918,12 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
if(i) ++c, --i; /* just get the name */
if (i >= 6 && strncmp(c, "main::", 6) == 0) {
c += 4;
- if (i == 6) i = 0; else i -= 4;
+#if PERL_VERSION < 7
+ if (i == 6 || (i == 7 && c[6] == '\0'))
+#else
+ if (i == 6)
+#endif
+ i = 0; else i -= 4;
}
if (needs_quote(c,i)) {
#ifdef GvNAMEUTF8
diff --git a/dist/Data-Dumper/t/bugs.t b/dist/Data-Dumper/t/bugs.t
index 0533765476..e8d2126310 100644
--- a/dist/Data-Dumper/t/bugs.t
+++ b/dist/Data-Dumper/t/bugs.t
@@ -109,8 +109,13 @@ SKIP: {
no strict 'refs';
is eval(Dumper \*{"foo::b\0ar"}), \*{"foo::b\0ar"},
'GVs with nulls';
- is eval Dumper(\*{chr 256}), \*{chr 256},
+ # There is a strange 5.6 bug that causes the eval to fail a supposed
+ # strict vars test (involving $VAR1). Mentioning the glob beforehand
+ # somehow makes it go away.
+ () = \*{chr 256};
+ is eval Dumper(\*{chr 256})||die ($@), \*{chr 256},
'GVs with UTF8 names (or not, depending on perl version)';
+ () = \*{"\0".chr 256}; # same bug
is eval Dumper(\*{"\0".chr 256}), \*{"\0".chr 256},
'GVs with UTF8 and nulls';
};