diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-07 14:58:06 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-07 14:58:06 +0000 |
commit | 6cb8f8aa0b354a4c64f58414ffb96b4138d3a098 (patch) | |
tree | f3f921b4fe91279e7bead513ea0d7b30e7915292 /t | |
parent | 6506d41e37a08a736224b707fc0f70b63fb8e740 (diff) | |
download | perl-6cb8f8aa0b354a4c64f58414ffb96b4138d3a098.tar.gz |
Add display() for displaying icky scalars.
p4raw-id: //depot/perl@13513
Diffstat (limited to 't')
-rw-r--r-- | t/test.pl | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 { |