/usr/share/perl5/cs/DEBUG.pm is in info2man 1.1-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #!/usr/bin/perl
use strict qw(vars);
package cs::DEBUG;
%cs::DEBUG::Trace=( USE => defined($ENV{'csPLDEBUG'})
&& length($ENV{'csPLDEBUG'}) > 0,
EXPORT => 1
);
{ package main;
if (defined $ENV{'csPLDEBUG'})
{ my $dbg=join(';',
map('warn "DEBUG: debugging package '.$_.'\n");$cs::'.$_.'::DEBUG=1',
grep(/^[a-z_][:\w]*$/i,split(/,+/,$ENV{'csPLDEBUG'}))));
eval $dbg;
warn "cs::DEBUG: $@ in [$dbg]" if $@;
}
}
# $Exporter::Verbose=$Trace{EXPORT};
sub using
{ my(@c)=caller(1);
## pstack();
print STDERR "$0: using @_ from [@c]\n" if $cs::DEBUG::Trace{USE};
}
sub err
{ my($err,$arg)=@_;
cs::Upd::err($err);
if (defined $arg)
{ warn "arg = ".cs::Hier::h2a($arg,1)."\n";
pstack();
}
}
sub pstack
{ my(@s)=cstack(1);
my($p,$f,$l,$sub);
for (@s)
{ ($p,$f,$l,$sub)=@$_;
warn "$f:$l: ${p}::$sub\n";
}
}
sub cstack
{ my($i)=shift;
my(@s,@c);
$i=0 unless defined $i;
CALL:
while (@c=caller($i))
{ push(@s,[ @c ]);
$i++;
}
@s;
}
sub phash
{ my($h)=@_;
my(@c)=caller;
warn "phash($h) from [@c]\n";
for my $hkey (sort keys %$h)
{ my($val)=$h->{$hkey};
warn "\t$hkey=$val\n";
if (ref $val
&& ::reftype($val) eq ARRAY)
{
for my $i (0..$#$val)
{ warn "\t$hkey\[$i]=$val->[$i]\n";
}
}
}
}
1;
|