| 1 | package Scope::Container::DBI; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Scope::Container; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use Log::Minimal; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use List::Util qw/shuffle/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use Time::HiRes qw//; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use Module::Load qw/load/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use DBI 1.615; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | our $VERSION = '0.09'; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | our $DBI_CLASS = 'DBI'; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 104 | ▶ | sub connect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect: called CC=22 SCAR=31.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 104 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 104 | ▶ | if ( @_ && (ref $_[0] || '' eq 'ARRAY') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition80%4/5
@_ and
ref $_[0] or
MC/DC50%1/2
@_ and
@_
ref $_[0]
Truth table66%2/3
A and B
A= @_B= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 36 | my @dsn = @_; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 36 | my $dbi; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 36 | my $dsn_key = _build_dsn_key(@dsn); | |||||||||||||||||||||||||||||||||||||||||
| 25 | 36 | my $dbh = _lookup_cache($dsn_key); | |||||||||||||||||||||||||||||||||||||||||
| 26 | 36 | ▶ | return $dbh if $dbh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 33 | for my $s_dsn ( shuffle(@dsn) ) { | |||||||||||||||||||||||||||||||||||||||||
| 29 | 45 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 30 | 45 | ($dbh, $dbi) = $class->connect(@$s_dsn); | |||||||||||||||||||||||||||||||||||||||||
| 31 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 45 | ▶ | infof("Connection failed: " . $@) if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 45 | ▶ | last if ( $dbh ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 33 | ▶ | if ( $dbh ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 33 | _save_cache($dsn_key, $dbi); | |||||||||||||||||||||||||||||||||||||||||
| 38 | 33 | ▶ | return wantarray ? ( $dbh, $dbi) : $dbh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | croak("couldn't connect all DB, " . | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | join(",", map { $_->[0] } @dsn)); | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 68 | my @dsn = @_; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 68 | my $dsn_key = _build_dsn_key(\@dsn); | |||||||||||||||||||||||||||||||||||||||||
| 47 | 68 | my $cached_dbh = _lookup_cache($dsn_key); | |||||||||||||||||||||||||||||||||||||||||
| 48 | 68 | ▶ | return $cached_dbh if $cached_dbh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 62 | my ($dsn, $user, $pass, $attr) = @dsn; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 62 | ▶ | $attr ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$attr ||= {}
MC/DC100%1/1
$attr ||= {}
$attr
Truth table100%2/2
A
A= $attr
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 62 | $attr->{AutoInactiveDestroy} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 62 | ▶ | my $retry = exists $attr->{ScopeContainerConnectRetry} ? delete $attr->{ScopeContainerConnectRetry} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 62 | my $sleep = delete $attr->{ScopeContainerConnectRetrySleep}; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 62 | ▶ | $sleep = $sleep / 1000 if $sleep; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 62 | ▶ | if ( ! is_class_loaded($DBI_CLASS) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | load $DBI_CLASS; | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 62 | my $lasterrstr; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 62 | my $dbh = do { | |||||||||||||||||||||||||||||||||||||||||
| 62 | 62 | my $connect; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 62 | for ( 1..$retry ) { | |||||||||||||||||||||||||||||||||||||||||
| 64 | 64 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 64 | ▶ | if ($INC{'Apache/DBI.pm'} && $ENV{MOD_PERL}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$INC{"Apache/DBI.pm"} and $ENV{"MOD_PERL"}
MC/DC0%0/2
$INC{"Apache/DBI.pm"} and $ENV{"MOD_PERL"}
$INC{"Apache/DBI.pm"}
$ENV{"MOD_PERL"}
Truth table33%1/3
A and B
A= $INC{"Apache/DBI.pm"}B= $ENV{"MOD_PERL"}
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | local $DBI::connect_via = 'connect'; # Disable Apache::DBI. | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $connect = $DBI_CLASS->connect( $dsn, $user, $pass, $attr ); | |||||||||||||||||||||||||||||||||||||||||
| 68 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 64 | $connect = $DBI_CLASS->connect( $dsn, $user, $pass, $attr ); | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 60 | ▶ | die $DBI::errstr."\n" unless $connect; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 16 | ▶ | catch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 16 | $lasterrstr = $_; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 64 | }; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 64 | ▶ | last if $connect; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 16 | ▶ | Time::HiRes::sleep($sleep) if $sleep && $retry != $_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sleep and $retry != $_
MC/DC50%1/2
$sleep and $retry != $_
$sleep
$retry != $_
Truth table66%2/3
A and B
A= $sleepB= $retry != $_
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 62 | $connect; | |||||||||||||||||||||||||||||||||||||||||
| 80 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 62 | ▶ | croak($lasterrstr) if !$dbh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 48 | my $dbi = { | |||||||||||||||||||||||||||||||||||||||||
| 84 | dbh => $dbh, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | pid => $$, | ||||||||||||||||||||||||||||||||||||||||||
| 86 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 48 | ▶ | $dbi->{tid} = threads->tid if $INC{'threads.pm'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 48 | _save_cache($dsn_key, $dbi); | |||||||||||||||||||||||||||||||||||||||||
| 90 | 48 | ▶ | return wantarray ? ( $dbh, $dbi ) : $dbh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 104 | ▶ | sub _build_dsn_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_dsn_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 104 | my @dsn = @_; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 104 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 104 | local $Data::Dumper::Indent = 0; | |||||||||||||||||||||||||||||||||||||||||
| 98 | 104 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 104 | my $key = Data::Dumper::Dumper(\@dsn); | |||||||||||||||||||||||||||||||||||||||||
| 100 | 104 | "sc:dbix:".$key; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 104 | ▶ | sub _lookup_cache { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lookup_cache: called CC=8 SCAR=22.5
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 104 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 104 | ▶ | return unless in_scope_container(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 31 | my $dbi = scope_container($key); | |||||||||||||||||||||||||||||||||||||||||
| 107 | 31 | ▶ | return if !$dbi; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 10 | my $dbh = $dbi->{dbh}; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 10 | ▶ | if ( defined $dbi->{tid} && $dbi->{tid} != threads->tid ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $dbi->{"tid"} and $dbi->{"tid"} != "threads"->tid
MC/DC0%0/2
defined $dbi->{"tid"} and $dbi->{"tid"} != "threads"->tid
defined $dbi->{"tid"}
$dbi->{"tid"} != "threads"->tid
Truth table33%1/3
A and B
A= defined $dbi->{"tid"}B= $dbi->{"tid"} != "threads"->tid
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 10 | ▶ | if ( $dbi->{pid} != $$ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | $dbh->STORE(InactiveDestroy => 1); | |||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 9 | ▶ | return $dbh if $dbh->FETCH('Active') && $dbh->ping; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dbh->FETCH("Active") and $dbh->ping
MC/DC0%0/2
$dbh->FETCH("Active") and $dbh->ping
$dbh->FETCH("Active")
$dbh->ping
Truth table33%1/3
A and B
A= $dbh->FETCH("Active")B= $dbh->ping
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 81 | ▶ | sub _save_cache { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_save_cache: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 81 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 81 | ▶ | return unless in_scope_container(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 20 | scope_container($key, shift); | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | # stolen from Mouse::PurePerl | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 62 | ▶ | sub is_class_loaded { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_class_loaded: called CC=17 SCAR=37.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 62 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 62 | ▶ | return 0 if ref($class) || !defined($class) || !length($class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $class or not defined $class or not length $class
ref $class or not defined $class
MC/DC0%0/3
ref $class or not defined $class or not length $class
ref $class
not defined $class
not length $class
Truth table25%1/4
A or not(B) or not(C)
A= ref $classB= not defined $classC= not length $class
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | # walk the symbol table tree to avoid autovififying | ||||||||||||||||||||||||||||||||||||||||||
| 134 | # \*{${main::}{"Foo::"}{"Bar::"}} == \*main::Foo::Bar:: | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 62 | my $pack = \%::; | |||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 62 | foreach my $part (split('::', $class)) { | |||||||||||||||||||||||||||||||||||||||||
| 139 | 62 | $part .= '::'; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 62 | ▶ | return 0 if !exists $pack->{$part}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 62 | my $entry = \$pack->{$part}; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 62 | ▶ | return 0 if ref($entry) ne 'GLOB'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 62 | $pack = *{$entry}{HASH}; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 62 | ▶ | return 0 if !%{$pack}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | # check for $VERSION or @ISA | ||||||||||||||||||||||||||||||||||||||||||
| 150 | return 1 if exists $pack->{VERSION} | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 62 | ▶ | && defined *{$pack->{VERSION}}{SCALAR} && defined ${ $pack->{VERSION} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
exists $pack->{"VERSION"} and defined *{$pack->{"VERSION"};}{"SCALAR"} and defined ${$$pack{"VERSION"};}
exists $pack->{"VERSION"} and defined *{$pack->{"VERSION"};}{"SCALAR"}
MC/DC33%1/3
exists $pack->{"VERSION"} and defined *{$pack->{"VERSION"};}{"SCALAR"} and defined ${$$pack{"VERSION"};}
exists $pack->{"VERSION"}
defined *{$pack->{"VERSION"};}{"SCALAR"}
defined ${$$pack{"VERSION"};}
Truth table50%2/4
A and B and C
A= exists $pack->{"VERSION"}B= defined *{$pack->{"VERSION"};}{"SCALAR"}C= defined ${$$pack{"VERSION"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | return 1 if exists $pack->{ISA} | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | ▶ | && defined *{$pack->{ISA}}{ARRAY} && @{ $pack->{ISA} } != 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $pack->{"ISA"} and defined *{$pack->{"ISA"};}{"ARRAY"} and @{$pack->{"ISA"};} != 0
exists $pack->{"ISA"} and defined *{$pack->{"ISA"};}{"ARRAY"}
MC/DC0%0/3
exists $pack->{"ISA"} and defined *{$pack->{"ISA"};}{"ARRAY"} and @{$pack->{"ISA"};} != 0
exists $pack->{"ISA"}
defined *{$pack->{"ISA"};}{"ARRAY"}
@{$pack->{"ISA"};} != 0
Truth table25%1/4
A and B and C
A= exists $pack->{"ISA"}B= defined *{$pack->{"ISA"};}{"ARRAY"}C= @{$pack->{"ISA"};} != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | # check for any method | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | foreach my $name( keys %{$pack} ) { | |||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $entry = \$pack->{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | return 1 if ref($entry) ne 'GLOB' || defined *{$entry}{CODE}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $entry ne "GLOB" or defined *{$entry;}{"CODE"}
MC/DC0%0/2
ref $entry ne "GLOB" or defined *{$entry;}{"CODE"}
ref $entry ne "GLOB"
defined *{$entry;}{"CODE"}
Truth table0%0/3
A or B
A= ref $entry ne "GLOB"B= defined *{$entry;}{"CODE"}
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | # fail | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 167 | __END__ | ||||||||||||||||||||||||||||||||||||||||||