| 1 | # $Id: Hook.pm,v 1.3 2005/11/29 11:55:01 dk Exp $ | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package DBIx::Roles::Hook; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use vars qw(%defaults $VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | $VERSION = '1.00'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | %defaults = ( | |||||||||||||||||||||||||||
| 11 | Hooks => {} | ||||||||||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 4 | ▶ | sub initialize { undef, \%defaults } | ||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | sub connect | ||||||||||||||||||||||||||||
| 17 | 9 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
connect: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 9 | my ( $self, $storage, @param) = @_; | |||||||||||||||||||||||||||
| 19 | 9 | ▶ | return $self-> super( @param) unless exists $self-> {attr}-> {Hooks}-> {connect}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | $self-> {attr}-> {Hooks}-> {connect}->( @param); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | sub disconnect | ||||||||||||||||||||||||||||
| 24 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 3 | my ( $self, $storage, @param) = @_; | |||||||||||||||||||||||||||
| 26 | 3 | ▶ | return $self-> super( @param) unless exists $self-> {attr}-> {Hooks}-> {disconnect}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 2 | $self-> {attr}-> {Hooks}-> {disconnect}->( @param); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | sub any | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
any: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | 0 | my ( $self, $storage, $method, @param) = @_; | |||||||||||||||||||||||||||
| 33 | 0 | ▶ | return $self-> super( $method, @param) unless exists $self-> {attr}-> {Hooks}-> {$method}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | $self-> {attr}-> {Hooks}-> {$method}->( $self, $storage, @param); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub rewrite | ||||||||||||||||||||||||||||
| 38 | 13 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
rewrite: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 13 | my ( $self, $storage, $method, @param) = @_; | |||||||||||||||||||||||||||
| 40 | 13 | ▶ | return $self-> super( $method, @param) unless exists $self-> {attr}-> {Hooks}-> {"rewrite_$method"}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 0 | $self-> {attr}-> {Hooks}-> {"rewrite_$method"}->( $self, $storage, @param); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | sub dbi_method | ||||||||||||||||||||||||||||
| 45 | 12 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
dbi_method: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 12 | my ( $self, $storage, $method, @param) = @_; | |||||||||||||||||||||||||||
| 47 | 12 | ▶ | return $self-> super( $method, @param) unless exists $self-> {attr}-> {Hooks}-> {$method}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 12 | $self-> {attr}-> {Hooks}-> {$method}->( $self, $storage, @param); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | sub STORE | ||||||||||||||||||||||||||||
| 52 | 17 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 53 | 17 | my ( $self, $storage, $key, $val) = @_; | |||||||||||||||||||||||||||
| 54 | return $self-> super( $key, $val) if | ||||||||||||||||||||||||||||
| 55 | $key eq 'Hooks' or | ||||||||||||||||||||||||||||
| 56 | 17 | ▶ | not exists $self-> {attr}-> {Hooks}-> {STORE}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$key eq "Hooks" or not exists $self->{"attr"}{"Hooks"}{"STORE"}
MC/DC0%0/2
$key eq "Hooks" or not exists $self->{"attr"}{"Hooks"}{"STORE"}
$key eq "Hooks"
not exists $self->{"attr"}{"Hooks"}{"STORE"}
Truth table66%2/3
A or not(B)
A= $key eq "Hooks"B= not exists $self->{"attr"}{"Hooks"}{"STORE"}
| |||||||||||||||||||||||||||||
| 57 | 0 | $self-> {attr}-> {Hooks}-> {STORE}->( @_); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 1 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | __DATA__ | ||||||||||||||||||||||||||||