Roles/Hook.pm

filter: Statementstmt 78.5% 22 / 28 Branchbran 50.0% 6 / 12 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 6 totaltotal 63.3% 38 / 60 CC 8 SCAR 9.8
CC
8
Cov
70%
any
6.0
STORE
3.5
connect
2.3
CRAP 2.7
« Roles/InlineArray.pm ↑ Summary Roles/SQLAbstract.pm »
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
BranchTrueFalseTotal
unless exists $self->{"attr"}{"Hooks"}{"connect"} 9 0 9
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
BranchTrueFalseTotal
unless exists $self->{"attr"}{"Hooks"}{"disconnect"} 1 2 3
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
BranchTrueFalseTotal
unless exists $self->{"attr"}{"Hooks"}{$method} 0 0 0
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
BranchTrueFalseTotal
unless exists $self->{"attr"}{"Hooks"}{"rewrite_$method"} 13 0 13
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
BranchTrueFalseTotal
unless exists $self->{"attr"}{"Hooks"}{$method} 0 12 12
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
BranchTrueFalseTotal
if $key eq "Hooks" or not exists $self->{"attr"}{"Hooks"}{"STORE"} 17 0 17
Condition66%2/3
$key eq "Hooks" or not exists $self->{"attr"}{"Hooks"}{"STORE"}
l!l&&r!l&&!r
1160
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"}
ABresult
1X1
011
000
57 0 $self-> {attr}-> {Hooks}-> {STORE}->( @_);
58 }
59  
60 1 1;
61  
62 __DATA__
« Roles/InlineArray.pm ↑ Summary Roles/SQLAbstract.pm »