| 1 | package App::ZofCMS::Plugin::Base; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 28 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 28 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 28 | our $VERSION = '1.001010'; # VERSION | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 0 | ▶ | sub new { bless {}, shift } | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub process { | ||||||||||||||||||||||||||
|
Subroutine
process: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 0 | my ( $self, $template, $query, $config ) = @_; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | my $key = $self->_key; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | $template->{$key} = $template->{$key}->( $template, $query, $config ) | ||||||||||||||||||||||||||||
| 16 | 0 | ▶ | if ref $template->{$key} eq 'CODE'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | $config->conf->{$key} = $config->conf->{$key}->( $template, $query, $config ) | ||||||||||||||||||||||||||||
| 19 | 0 | ▶ | if ref $config->conf->{$key} eq 'CODE'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | return | ||||||||||||||||||||||||||||
| 22 | unless $template->{$key} | ||||||||||||||||||||||||||||
| 23 | 0 | ▶ | or $config->conf->{$key}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$template->{$key} or $config->conf->{$key}
MC/DC0%0/2
$template->{$key} or $config->conf->{$key}
$template->{$key}
$config->conf->{$key}
Truth table0%0/3
A or B
A= $template->{$key}B= $config->conf->{$key}
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | my %conf = ( | ||||||||||||||||||||||||||||
| 26 | $self->_defaults, | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | %{ delete $config->conf->{$key} || {} }, | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $config->conf->{$key} || {}
MC/DC0%0/1
delete $config->conf->{$key} || {}
delete $config->conf->{$key}
Truth table0%0/2
A
A= delete $config->conf->{$key}
| |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | %{ delete $template->{$key} || {} }, | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $template->{$key} || {}
MC/DC0%0/1
delete $template->{$key} || {}
delete $template->{$key}
Truth table0%0/2
A
A= delete $template->{$key}
| |||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | $self->_do( \%conf, $template, $query, $config ); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub _key { 'base' } | ||||||||||||||||||||||||||
|
Subroutine
_key: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub _defaults { () } | ||||||||||||||||||||||||||
|
Subroutine
_defaults: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub _has_value { | ||||||||||||||||||||||||||
|
Subroutine
_has_value: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 37 | 0 | my $v = shift; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return 1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $v and length $v
MC/DC0%0/2
defined $v and length $v
defined $v
length $v
Truth table0%0/3
A and B
A= defined $vB= length $v
| |||||||||||||||||||||||||||||
| 40 | if defined $v and length $v; | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | return 0; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub _dbh { | ||||||||||||||||||||||||||
|
Subroutine
_dbh: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 46 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | return $self->{DBH} | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if $self->{DBH}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | $self->{DBH} = DBI->connect_cached( | ||||||||||||||||||||||||||||
| 52 | 0 | @{ $self->{CONF} }{ qw/dsn user pass opt/ }, | |||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | return $self->{DBH}; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 28 | 1; | |||||||||||||||||||||||||||
| 59 | __END__ | ||||||||||||||||||||||||||||