| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# $Id: Hook.pm,v 1.3 2005/11/29 11:55:01 dk Exp $ |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package DBIx::Roles::Hook; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
47
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw(%defaults $VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
457
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '1.00'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
%defaults = ( |
|
11
|
|
|
|
|
|
|
Hooks => {} |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
0
|
17
|
sub initialize { undef, \%defaults } |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub connect |
|
17
|
|
|
|
|
|
|
{ |
|
18
|
9
|
|
|
9
|
0
|
26
|
my ( $self, $storage, @param) = @_; |
|
19
|
9
|
50
|
|
|
|
53
|
return $self-> super( @param) unless exists $self-> {attr}-> {Hooks}-> {connect}; |
|
20
|
0
|
|
|
|
|
0
|
$self-> {attr}-> {Hooks}-> {connect}->( @param); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub disconnect |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
3
|
|
|
3
|
0
|
6
|
my ( $self, $storage, @param) = @_; |
|
26
|
3
|
100
|
|
|
|
17
|
return $self-> super( @param) unless exists $self-> {attr}-> {Hooks}-> {disconnect}; |
|
27
|
2
|
|
|
|
|
8
|
$self-> {attr}-> {Hooks}-> {disconnect}->( @param); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub any |
|
31
|
|
|
|
|
|
|
{ |
|
32
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $storage, $method, @param) = @_; |
|
33
|
0
|
0
|
|
|
|
0
|
return $self-> super( $method, @param) unless exists $self-> {attr}-> {Hooks}-> {$method}; |
|
34
|
0
|
|
|
|
|
0
|
$self-> {attr}-> {Hooks}-> {$method}->( $self, $storage, @param); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub rewrite |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
13
|
|
|
13
|
0
|
38
|
my ( $self, $storage, $method, @param) = @_; |
|
40
|
13
|
50
|
|
|
|
86
|
return $self-> super( $method, @param) unless exists $self-> {attr}-> {Hooks}-> {"rewrite_$method"}; |
|
41
|
0
|
|
|
|
|
0
|
$self-> {attr}-> {Hooks}-> {"rewrite_$method"}->( $self, $storage, @param); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub dbi_method |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
12
|
|
|
12
|
0
|
37
|
my ( $self, $storage, $method, @param) = @_; |
|
47
|
12
|
50
|
|
|
|
53
|
return $self-> super( $method, @param) unless exists $self-> {attr}-> {Hooks}-> {$method}; |
|
48
|
12
|
|
|
|
|
54
|
$self-> {attr}-> {Hooks}-> {$method}->( $self, $storage, @param); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub STORE |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
17
|
|
|
17
|
|
138
|
my ( $self, $storage, $key, $val) = @_; |
|
54
|
17
|
50
|
66
|
|
|
130
|
return $self-> super( $key, $val) if |
|
55
|
|
|
|
|
|
|
$key eq 'Hooks' or |
|
56
|
|
|
|
|
|
|
not exists $self-> {attr}-> {Hooks}-> {STORE}; |
|
57
|
0
|
|
|
|
|
|
$self-> {attr}-> {Hooks}-> {STORE}->( @_); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__DATA__ |