+# 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;
$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);
# 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;
}
while (my %i = caller_info(++$i)) {
$mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
+ }
return $mess || $err;
}