Change 13513 by jhi@alpha on 2001/12/07 14:58:06

        Add display() for displaying icky scalars.

Affected files ...

.... //depot/perl/t/test.pl#15 edit

Differences ...

==== //depot/perl/t/test.pl#15 (text) ====
Index: perl/t/test.pl
--- perl/t/test.pl.~1~  Fri Dec  7 08:15:05 2001
+++ perl/t/test.pl      Fri Dec  7 08:15:05 2001
@@ -263,6 +263,12 @@
 }
 
 
+# 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 {
End of Patch.

Reply via email to