summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-12-07 14:58:06 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-12-07 14:58:06 +0000
commit6cb8f8aa0b354a4c64f58414ffb96b4138d3a098 (patch)
treef3f921b4fe91279e7bead513ea0d7b30e7915292 /t
parent6506d41e37a08a736224b707fc0f70b63fb8e740 (diff)
downloadperl-6cb8f8aa0b354a4c64f58414ffb96b4138d3a098.tar.gz
Add display() for displaying icky scalars.
p4raw-id: //depot/perl@13513
Diffstat (limited to 't')
-rw-r--r--t/test.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/test.pl b/t/test.pl
index ca4af688dc..ac6bbb7938 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -263,6 +263,12 @@ sub BAILOUT {
}
+# A way to display scalars containing control characters and Unicode.
+sub display {
+ join("", map { $_ > 255 ? sprintf("\\x{%x}", $_) : chr($_) =~ /[[:cntrl:]]/ ? sprintf("\\%03o", $_) : chr($_) } unpack("U*", $_[0]));
+}
+
+
# A somewhat safer version of the sometimes wrong $^X.
BEGIN: {
eval {