# Carp::Heavy uses some variables in common with Carp.
package Carp;
=head1 NAME
Carp::Heavy - heavy machinery, no user serviceable parts inside
=cut
# use strict; # not yet
# On one line so MakeMaker will see it.
sub caller_info {
my $i = shift(@_) + 1;
package DB;
my %call_info;
} = caller($i);
unless (defined $call_info{pack}) {
return ();
}
$#args = $MaxArgNums;
push @args, '...';
}
# Push the args onto the subroutine
}
}
# Transform an argument to a function into a string.
sub format_arg {
my $arg = shift;
if (not defined($arg)) {
$arg = 'undef';
}
elsif (ref($arg)) {
}
$arg =~ s/'/\\'/g;
# Quote it?
# The following handling of "control chars" is direct from
# the original code - I think it is broken on Unicode though.
# Suggestions?
return $arg;
}
# Takes an inheritance cache and a package and returns
# an anon hash of known inheritances and anon array of
# inheritances which consequences have not been figured
# for.
sub get_status {
my $cache = shift;
my $pkg = shift;
}
# Takes the info from caller() and figures out the name of
sub get_subname {
my $info = shift;
if ($info->{is_require}) {
return "require $eval";
}
else {
$eval =~ s/([\\\'])/\\$1/g;
}
}
}
# Figures out what call (from the point of view of the caller)
# the long error backtrace should start at.
sub long_error_loc {
my $i;
{
my $pkg = caller(++$i);
unless(defined($pkg)) {
# This *shouldn't* happen.
if (%Internal) {
local %Internal;
$i = long_error_loc();
last;
}
else {
# OK, now I am irritated.
return 2;
}
}
redo if $CarpInternal{$pkg};
redo unless 0 > --$lvl;
}
return $i - 1;
}
sub longmess_heavy {
return @_ if ref($_[0]); # don't break references as exceptions
my $i = long_error_loc();
return ret_backtrace($i, @_);
}
# Returns a full stack backtrace starting from where it is
# told.
sub ret_backtrace {
my ($i, @error) = @_;
my $mess;
$i++;
my $tid_msg = '';
}
{ if ($err =~ /\n$/) { # extra block to localise $1 etc
}
else {
my %i = caller_info($i);
$mess = "$err at $i{file} line $i{line}$tid_msg\n";
}}
while (my %i = caller_info(++$i)) {
$mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
}
return $mess;
}
sub ret_summary {
my ($i, @error) = @_;
my $mess;
$i++;
my $tid_msg = '';
}
my %i = caller_info($i);
return "$err at $i{file} line $i{line}$tid_msg\n";
}
sub short_error_loc {
my $cache;
my $i = 1;
{
my $called = caller($i++);
my $caller = caller($i);
redo if $CarpInternal{$called};
redo unless 0 > --$lvl;
}
return $i - 1;
}
sub shortmess_heavy {
return longmess_heavy(@_) if $Verbose;
return @_ if ref($_[0]); # don't break references as exceptions
my $i = short_error_loc();
if ($i) {
ret_summary($i, @_);
}
else {
longmess_heavy(@_);
}
}
# If a string is too long, trims it with ...
sub str_len_trim {
my $str = shift;
my $max = shift || 0;
}
return $str;
}
# Takes two packages and an optional cache. Says whether the
# first inherits from the second.
#
# Recursive versions of this have to work to avoid certain
# possible endless loops, and when following long chains of
# inheritance are less efficient.
sub trusts {
my $child = shift;
my $parent = shift;
my $cache = shift || {};
# Figure out consequences until we have an answer
push @$partial, @$anc_partial;
}
}
# Takes a package and gives a list of those trusted directly
sub trusts_directly {
my $class = shift;
no strict 'refs';
no warnings 'once';
return @{"$class\::CARP_NOT"}
? @{"$class\::CARP_NOT"}
: @{"$class\::ISA"};
}
1;