-
Notifications
You must be signed in to change notification settings - Fork 26
/
Null.pm
47 lines (35 loc) · 965 Bytes
/
Null.pm
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
# $Id$
# This `perl -d` debugging module is an ad-hoc custom debugger. It's
# optional, and it may not even work.
use strict;
use vars qw($VERSION);
$VERSION = do {my($r)=(q$Revision$=~/(\d+)/);sprintf"1.%04d",$r};
package Null; # satisfies 'use'
package DB;
use vars qw($sub);
use Carp;
# This bit traces execution immediately before a given condition.
# It's used to find out where in hell something went worng.
my @trace = ("no step") x 16;
sub DB {
my ($package, $file, $line) = caller;
my $discard = shift @trace;
push @trace, "step @ $file:$line: ";
if ( defined($POE::Kernel::poe_kernel)
and @{$POE::Kernel::poe_kernel->[8]}
and $POE::Kernel::poe_kernel->[8]->[0]->[2] =~ /\-\</
) {
$| = 1;
print join("\n", @trace), "\n";
kill -9, $$;
exit;
}
# print "step @ $file:$line\n";
}
sub sub {
my ($package, $file, $line) = caller;
# print "sub $sub @ $file:$line\n";
no strict 'refs';
&$sub;
}
1;