| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package AutoCode::Root0; |
|
2
|
7
|
|
|
7
|
|
36
|
use strict; |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
16646
|
|
|
3
|
|
|
|
|
|
|
our $VERSION='0.01'; |
|
4
|
|
|
|
|
|
|
our $DEBUG; |
|
5
|
|
|
|
|
|
|
our $debug; |
|
6
|
101
|
|
|
101
|
|
25199
|
sub import { |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
} |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
|
11
|
|
|
|
|
|
|
|
|
12
|
74
|
|
|
74
|
0
|
1739
|
my ($class, @args)=@_; |
|
13
|
74
|
|
|
|
|
132
|
my $self={}; |
|
14
|
74
|
|
33
|
|
|
436
|
bless $self, ref($class)||$class; |
|
15
|
74
|
|
|
|
|
540
|
$self->_initialize(@args); |
|
16
|
74
|
|
|
|
|
2510
|
return $self; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _initialize { |
|
21
|
55
|
|
|
55
|
|
112
|
my ($self, @args)=@_; |
|
22
|
55
|
|
|
|
|
336
|
$self->{DEBUG_HINTS_SLOT} = {}; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _rearrange { |
|
26
|
49
|
|
|
49
|
|
80
|
my $dummy = shift; |
|
27
|
49
|
|
|
|
|
62
|
my $order = shift; |
|
28
|
|
|
|
|
|
|
|
|
29
|
49
|
100
|
100
|
|
|
318
|
return @_ unless (substr($_[0]||'',0,1) eq '-'); |
|
30
|
46
|
50
|
|
|
|
130
|
push @_,undef unless $#_ %2; |
|
31
|
46
|
|
|
|
|
63
|
my %param; |
|
32
|
46
|
|
|
|
|
110
|
while( @_ ) { |
|
33
|
100
|
|
|
|
|
169
|
(my $key = shift) =~ tr/a-z\055/A-Z/d; #deletes all dashes! |
|
34
|
100
|
|
|
|
|
294
|
$param{$key} = shift; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
46
|
|
|
|
|
88
|
map { $_ = uc($_) } @$order; # for bug #1343, but is there perf hit here? |
|
|
122
|
|
|
|
|
271
|
|
|
37
|
46
|
|
|
|
|
541
|
return @param{@$order}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _load_module { |
|
41
|
3
|
|
|
3
|
|
7
|
my ($self, $name) = @_; |
|
42
|
3
|
|
|
|
|
5
|
my ($module, $load, $m); |
|
43
|
3
|
|
|
|
|
10
|
$module = "_<$name.pm"; |
|
44
|
3
|
50
|
|
|
|
14
|
return 1 if $main::{$module}; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# untaint operation for safe web-based running (modified after a fix |
|
47
|
|
|
|
|
|
|
# a fix by Lincoln) HL |
|
48
|
3
|
50
|
|
|
|
35
|
if ($name !~ /^([\w:]+)$/) { |
|
49
|
0
|
|
|
|
|
0
|
$self->throw("$name is an illegal perl package name"); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
10
|
$load = "$name.pm"; |
|
53
|
|
|
|
|
|
|
# my $io = Bio::Root::IO->new(); |
|
54
|
|
|
|
|
|
|
# catfile comes from IO |
|
55
|
|
|
|
|
|
|
# $load = $io->catfile((split(/::/,$load))); |
|
56
|
3
|
|
|
|
|
21
|
$load=join('/', split(/::/, $load)); |
|
57
|
3
|
|
|
|
|
6
|
eval { |
|
58
|
3
|
|
|
|
|
1214
|
require $load; |
|
59
|
|
|
|
|
|
|
}; |
|
60
|
3
|
50
|
|
|
|
181
|
if ( $@ ) { |
|
61
|
0
|
|
|
|
|
0
|
die "Failed to load module $name. ".$@."\n"; |
|
62
|
|
|
|
|
|
|
# $self->throw("Failed to load module $name. ".$@); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
3
|
|
|
|
|
15
|
return 1; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
our @DEBUG_HINTS=qw(enable verbosity); |
|
68
|
7
|
|
|
7
|
|
58
|
use constant DEBUG_HINTS_SLOT => '_DEBUG_HINTS'; |
|
|
7
|
|
|
|
|
13
|
|
|
|
7
|
|
|
|
|
5482
|
|
|
69
|
|
|
|
|
|
|
sub debug_hints { |
|
70
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
|
71
|
0
|
|
|
|
|
0
|
my %hints = %{$self->{DEBUG_HINTS_SLOT}}; |
|
|
0
|
|
|
|
|
0
|
|
|
72
|
0
|
|
|
|
|
0
|
my ($enable, $verbosity)=$self->_rearrange([qw(ENABLE VERBOSITY)], @_); |
|
73
|
0
|
0
|
|
|
|
0
|
defined $enable and $hints{enable}=$enable; |
|
74
|
0
|
0
|
|
|
|
0
|
defined $verbosity and $hints{verbosity}=$verbosity; |
|
75
|
|
|
|
|
|
|
# if(%args){ |
|
76
|
|
|
|
|
|
|
# $hints{$_}=$args{$_} if grep /$_/, @DEBUG_HINTS foreach(keys %args); |
|
77
|
|
|
|
|
|
|
# } |
|
78
|
0
|
|
|
|
|
0
|
return %hints; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub debug { |
|
82
|
142
|
|
|
142
|
0
|
170
|
my $self=shift; |
|
83
|
|
|
|
|
|
|
# return unless($self->{DEBUG_HINTS_SLOT}->{enable}); |
|
84
|
|
|
|
|
|
|
|
|
85
|
142
|
50
|
|
|
|
389
|
return unless $debug; |
|
86
|
0
|
|
|
|
|
|
my $pkg=caller; |
|
87
|
0
|
|
|
|
|
|
print STDERR "In $pkg, @_\n"; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub throw { |
|
91
|
0
|
|
|
0
|
0
|
|
my ($self, $string)=@_; |
|
92
|
0
|
|
|
|
|
|
my $out ="\n". '-'x20 . ' EXCEPTION '. '-'x20 . "\n"; |
|
93
|
0
|
|
|
|
|
|
$out .= "MSG: $string\n"; |
|
94
|
0
|
|
|
|
|
|
$out .= $self->stack_trace_dump .'-'x51 ."\n"; |
|
95
|
0
|
|
|
|
|
|
die $out; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub warn { |
|
99
|
0
|
|
|
0
|
0
|
|
my ($self, $msg)=@_; |
|
100
|
0
|
|
|
|
|
|
my $out="\n". '-'x20 . ' WARNING '. '-'x20 . "\n"; |
|
101
|
0
|
|
|
|
|
|
$out .= "MSG: $msg\n"; |
|
102
|
0
|
|
|
|
|
|
$out .= '-'x51 ."\n"; |
|
103
|
0
|
|
|
|
|
|
print STDERR $out; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub stack_trace_dump { |
|
107
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
|
108
|
0
|
|
|
|
|
|
my @stack=$self->stack_trace; |
|
109
|
0
|
|
|
|
|
|
eval{ |
|
110
|
|
|
|
|
|
|
#<< x 3; |
|
111
|
0
|
|
|
|
|
|
shift @stack; |
|
112
|
0
|
|
|
|
|
|
shift @stack;shift @stack; |
|
|
0
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
}; |
|
114
|
0
|
|
|
|
|
|
my $out; |
|
115
|
0
|
|
|
|
|
|
my ($module, $function, $file, $position); |
|
116
|
0
|
|
|
|
|
|
map { |
|
117
|
0
|
|
|
|
|
|
($module, $function, $file, $position)=@$_; |
|
118
|
0
|
|
|
|
|
|
$out.= "STACK $function $file:$position\n"; |
|
119
|
|
|
|
|
|
|
} @stack; |
|
120
|
0
|
|
|
|
|
|
return $out; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub stack_trace { |
|
124
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
|
125
|
0
|
|
|
|
|
|
my $i=0; |
|
126
|
0
|
|
|
|
|
|
my @out=(); |
|
127
|
0
|
|
|
|
|
|
my $prev=[]; |
|
128
|
0
|
|
|
|
|
|
while(my @call=caller($i++)){ |
|
129
|
0
|
|
|
|
|
|
$prev->[3]=$call[3]; |
|
130
|
0
|
|
|
|
|
|
push(@out, $prev); |
|
131
|
0
|
|
|
|
|
|
$prev=\@call; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
0
|
|
|
|
|
|
$prev->[3]='toplevel'; |
|
134
|
0
|
|
|
|
|
|
push @out, $prev; |
|
135
|
0
|
|
|
|
|
|
return @out; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub _not_implemented_msg { |
|
139
|
0
|
|
|
0
|
|
|
my $self=shift; |
|
140
|
0
|
|
|
|
|
|
my $pkg=ref $self; |
|
141
|
0
|
|
|
|
|
|
my $method=(caller(1))[3]; |
|
142
|
0
|
|
|
|
|
|
my $msg="Abstract method [$method] is not implemented by package $pkg.\n"; |
|
143
|
0
|
|
|
|
|
|
return $msg; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub throw_not_implemented { |
|
147
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
|
148
|
0
|
|
|
|
|
|
$self->throw($self->_not_implemented_msg); |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub warn_not_implemented { |
|
152
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
|
153
|
0
|
|
|
|
|
|
$self->warn($self->_not_implemented_msg); |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |