| 1 | package App::ZofCMS::Plugin::DBIPPT; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '1.001010'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use base 'App::ZofCMS::Plugin::Base'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use HTML::Entities; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub _key { 'plug_dbippt' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_key: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub _defaults { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_defaults: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | cell => 't', | |||||||||||||||||||||||||||||||||||||||||
| 15 | key => 'dbi', | ||||||||||||||||||||||||||||||||||||||||||
| 16 | n => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 17 | t => 'time', | ||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub _do { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my ( $self, $conf, $t, $q, $config ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | $conf->{key} = $conf->{key}->( $t, $q, $config ) | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if ref $conf->{key} eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | $conf->{n} = $conf->{n}->( $t, $q, $config ) | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | if ref $conf->{n} eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | $conf->{t} = $conf->{t}->( $t, $q, $config ) | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | if ref $conf->{t} eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | return | ||||||||||||||||||||||||||||||||||||||||||
| 33 | unless defined $conf->{key} | ||||||||||||||||||||||||||||||||||||||||||
| 34 | and ( defined $conf->{n} | ||||||||||||||||||||||||||||||||||||||||||
| 35 | or defined $conf->{t} | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $conf->{"key"} and defined $conf->{"n"} || defined $conf->{"t"}
defined $conf->{"n"} or defined $conf->{"t"}
MC/DC0%0/3
defined $conf->{"key"} and defined $conf->{"n"} || defined $conf->{"t"}
defined $conf->{"key"}
defined $conf->{"n"}
defined $conf->{"t"}
Truth table0%0/4
A and B or C
A= defined $conf->{"key"}B= defined $conf->{"n"}C= defined $conf->{"t"}
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | $conf->{key} = [ $conf->{key} ] | ||||||||||||||||||||||||||||||||||||||||||
| 39 | if not ref $conf->{key} | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | and defined $conf->{key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $conf->{"key"} and defined $conf->{"key"}
MC/DC0%0/2
not ref $conf->{"key"} and defined $conf->{"key"}
not ref $conf->{"key"}
defined $conf->{"key"}
Truth table0%0/3
not(A) and B
A= not ref $conf->{"key"}B= defined $conf->{"key"}
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | $conf->{t} = [ $conf->{t} ] | ||||||||||||||||||||||||||||||||||||||||||
| 43 | if not ref $conf->{t} | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | and defined $conf->{t}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $conf->{"t"} and defined $conf->{"t"}
MC/DC0%0/2
not ref $conf->{"t"} and defined $conf->{"t"}
not ref $conf->{"t"}
defined $conf->{"t"}
Truth table0%0/3
not(A) and B
A= not ref $conf->{"t"}B= defined $conf->{"t"}
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | $conf->{n} = [ $conf->{n} ] | ||||||||||||||||||||||||||||||||||||||||||
| 47 | if not ref $conf->{n} | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | and defined $conf->{n}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $conf->{"n"} and defined $conf->{"n"}
MC/DC0%0/2
not ref $conf->{"n"} and defined $conf->{"n"}
not ref $conf->{"n"}
defined $conf->{"n"}
Truth table0%0/3
not(A) and B
A= not ref $conf->{"n"}B= defined $conf->{"n"}
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | for ( @{ $conf->{key} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | _process_key( $t, $conf, $_ ); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub _process_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_key: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my ( $t, $conf, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $ref = $t->{ $conf->{cell} }{ $key }; | |||||||||||||||||||||||||||||||||||||||||
| 62 | return | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | unless defined $ref | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $ref and ref $ref eq "ARRAY" and @$ref
defined $ref and ref $ref eq "ARRAY"
MC/DC0%0/3
defined $ref and ref $ref eq "ARRAY" and @$ref
defined $ref
ref $ref eq "ARRAY"
@$ref
Truth table0%0/4
A and B and C
A= defined $refB= ref $ref eq "ARRAY"C= @$ref
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | and ref $ref eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 65 | and @$ref; | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $is_hash = ref $ref->[0] eq 'HASH'; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my @t = @{ $conf->{t} }; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my @n = @{ $conf->{n} }; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | for ( @$ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ( $is_hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | for ( @$_{ @n } ) { | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | encode_entities $_; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | s/\r?\n/<br>/g; | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | for ( @$_{ @t } ) { | |||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | $_ = localtime $_ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_ and length $_
MC/DC0%0/2
defined $_ and length $_
defined $_
length $_
Truth table0%0/3
A and B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | if defined and length; | ||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | for ( @$_[ @n ] ) { | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | encode_entities $_; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | s/\r?\n/<br>/g; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | for ( @$_[ @t ] ) { | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $_ = localtime $_ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_ and length $_
MC/DC0%0/2
defined $_ and length $_
defined $_
length $_
Truth table0%0/3
A and B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | if defined and length; | ||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 97 | __END__ | ||||||||||||||||||||||||||||||||||||||||||