| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DB::Pluggable; |
|
2
|
1
|
|
|
1
|
|
66796
|
use strict; |
|
|
1
|
|
|
|
|
13
|
|
|
|
1
|
|
|
|
|
29
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
4
|
1
|
|
|
1
|
|
23
|
use 5.010; |
|
|
1
|
|
|
|
|
4
|
|
|
5
|
1
|
|
|
1
|
|
425
|
use Brickyard::Accessor new => 1, rw => [qw(brickyard)]; |
|
|
1
|
|
|
|
|
536
|
|
|
|
1
|
|
|
|
|
7
|
|
|
6
|
1
|
|
|
1
|
|
508
|
use Brickyard 1.111750; |
|
|
1
|
|
|
|
|
2118
|
|
|
|
1
|
|
|
|
|
137
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.12'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub run_with_config { |
|
10
|
0
|
|
|
0
|
1
|
0
|
my $file = $_[1]; |
|
11
|
0
|
|
|
|
|
0
|
__PACKAGE__->new->init_from_config($file)->run; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub plugins_with { |
|
15
|
0
|
|
|
0
|
1
|
0
|
my ($self, $role) = @_; |
|
16
|
0
|
|
|
|
|
0
|
$self->brickyard->plugins_with($role); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init_from_config { |
|
20
|
1
|
|
|
1
|
1
|
92
|
my $self = shift; |
|
21
|
1
|
|
|
|
|
10
|
$self->brickyard(Brickyard->new(base_package => 'DB::Pluggable')); |
|
22
|
1
|
|
|
|
|
21
|
$self->brickyard->init_from_config(@_); |
|
23
|
1
|
|
|
|
|
51
|
$self; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub enable_watchfunction { |
|
27
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
28
|
1
|
|
|
1
|
|
7
|
no warnings 'once'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
268
|
|
|
29
|
0
|
|
|
|
|
|
$DB::trace |= 4; # Enable watchfunction |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub run { |
|
33
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
34
|
0
|
|
|
|
|
|
$DB::Pluggable::HANDLER = $self; |
|
35
|
0
|
|
|
|
|
|
$_->initialize for $self->plugins_with(-Initializer); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
1; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# switch package so as to get the desired stack trace |
|
40
|
|
|
|
|
|
|
package # hide from PAUSE indexer |
|
41
|
|
|
|
|
|
|
DB; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub watchfunction { |
|
44
|
0
|
0
|
|
0
|
0
|
|
return unless defined $DB::Pluggable::HANDLER; |
|
45
|
0
|
|
|
|
|
|
my $depth = 1; |
|
46
|
0
|
|
|
|
|
|
while (1) { |
|
47
|
0
|
|
|
|
|
|
my ($package, $file, $line, $sub) = caller $depth; |
|
48
|
0
|
0
|
|
|
|
|
last unless defined $package; |
|
49
|
0
|
0
|
|
|
|
|
return if $sub =~ /::DESTROY$/; |
|
50
|
0
|
|
|
|
|
|
$depth++; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
0
|
|
|
|
|
|
$_->watchfunction for $DB::Pluggable::HANDLER->plugins_with(-WatchFunction); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub afterinit { |
|
56
|
0
|
0
|
|
0
|
0
|
|
return unless defined $DB::Pluggable::HANDLER; |
|
57
|
0
|
|
|
|
|
|
$_->afterinit for $DB::Pluggable::HANDLER->plugins_with(-AfterInit); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
1
|
|
|
1
|
|
8
|
no warnings 'redefine'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
158
|
|
|
60
|
|
|
|
|
|
|
my $DB_eval = \&DB::eval; |
|
61
|
|
|
|
|
|
|
*eval = sub { |
|
62
|
0
|
|
|
0
|
|
|
my @result; |
|
63
|
0
|
|
|
|
|
|
for my $plugin ($DB::Pluggable::HANDLER->plugins_with(-Eval)) { |
|
64
|
0
|
|
|
|
|
|
push @result => $plugin->eval; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
0
|
|
|
|
|
|
&$DB_eval; # XXX Why doesn't this work if called from the plugin? |
|
67
|
0
|
|
|
|
|
|
$_->() for grep { ref eq 'CODE' } @result; |
|
|
0
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
}; |
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |