Add great_circle_direction().
[p5sagit/p5-mst-13.2.git] / lib / Carp / Heavy.pm
index d7b8990..a3d951b 100644 (file)
@@ -1,5 +1,18 @@
+# Carp::Heavy uses some variables in common with Carp.
 package Carp;
 
+=head1 NAME
+
+Carp heavy machinery - no user serviceable parts inside
+
+=cut
+
+# use strict; # not yet
+
+# On one line so MakeMaker will see it.
+use Carp;  our $VERSION = $Carp::VERSION;
+
+our ($CarpLevel, $MaxArgNums, $MaxEvalLen, $MaxLenArg, $Verbose);
 
 sub caller_info {
   my $i = shift(@_) + 1;
@@ -35,7 +48,7 @@ sub format_arg {
     $arg = 'undef';
   }
   elsif (ref($arg)) {
-    $arg .= ''; # Make it a string;
+      $arg = defined($overload::VERSION) ? overload::StrVal($arg) : "$arg";
   }
   $arg =~ s/'/\\'/g;
   $arg = str_len_trim($arg, $MaxLenArg);
@@ -46,8 +59,7 @@ sub format_arg {
   # The following handling of "control chars" is direct from
   # the original code - I think it is broken on Unicode though.
   # Suggestions?
-  $arg =~ s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg;
-  $arg =~ s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg;
+  $arg =~ s/([[:cntrl:]]|[[^:ascii:]])/sprintf("\\x{%x}",ord($1))/eg;
   return $arg;
 }
 
@@ -137,6 +149,7 @@ sub ret_backtrace {
 
   while (my %i = caller_info(++$i)) {
       $mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
+  }
   
   return $mess || $err;
 }