line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/local/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Stem::Debug ; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
22
|
use strict ; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
128
|
|
6
|
4
|
|
|
4
|
|
4005
|
use Data::Dumper ; |
|
4
|
|
|
|
|
38352
|
|
|
4
|
|
|
|
|
307
|
|
7
|
4
|
|
|
4
|
|
39
|
use Scalar::Util qw( openhandle ) ; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
337
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
22
|
use base 'Exporter' ; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
2121
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw ( dump_data dump_socket dump_owner ) ; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub dump_data { |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
0
|
|
my( $data ) = @_ ; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
local $Data::Dumper::Sortkeys = \&dump_filter ; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
return Dumper $data ; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub dump_filter { |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
0
|
|
my( $href ) = @_ ; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my @keys ; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my %fh_dumps ; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
while( my( $key, $val ) = each %{$href} ) { |
|
0
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if( my $fh_val = dump_socket( $val ) ) { |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $fh_key = "$key.FH" ; |
34
|
0
|
|
|
|
|
|
$fh_dumps{$fh_key} = $fh_val ; |
35
|
0
|
|
|
|
|
|
push @keys, $fh_key ; |
36
|
0
|
|
|
|
|
|
next ; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
push @keys, $key ; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
@{$href}{ keys %{fh_dumps} } = values %{fh_dumps} ; |
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#print "KEYS [@keys]\n" ; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return [ sort @keys ] ; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub dump_socket { |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
0
|
|
my ( $sock ) = @_ ; |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
return 'UNDEF' unless defined $sock ; |
54
|
0
|
0
|
|
|
|
|
return 'EMPTY' unless $sock ; |
55
|
0
|
0
|
|
|
|
|
return 'NOT REF' unless ref $sock ; |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
return 'NOT GLOB' unless $sock =~ /GLOB/ ; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
warn "SOCK [$sock]\n" ; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $fdnum = fileno( $sock ) ; |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
return 'NO FD' unless defined $fdnum ; |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
my $opened = openhandle( $sock ) ? 'OPEN' : 'CLOSED' ; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# return "CLOSED $sock" if $opened eq 'CLOSED' ; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# $fdnum = 'NONE' unless defined $fdnum ; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# my $fdnum = "FOO" ; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# return "FD [$fdnum]" unless $sock->isa('IO::Socket') ; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return "FD [$fdnum] *$opened* $sock" ; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub dump_owner { |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
0
|
0
|
|
my ( $owner ) = @_ ; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $owner_dump = "$owner" ; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
while( $owner->{object} ) { |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$owner = $owner->{object} ; |
89
|
0
|
|
|
|
|
|
$owner_dump .= " -> $owner " ; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
return $owner_dump ; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1 ; |