| 1 | ## no critic: TestingAndDebugging::RequireUseStrict | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Log::ger::Heavy; | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||||||||||||||||||||||||||||||||||
| 5 | 11 | our $DATE = '2023-12-29'; # DATE | |||||||||||||||||||||||||||||||||||||||||||||
| 6 | 11 | our $DIST = 'Log-ger'; # DIST | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | 11 | our $VERSION = '0.042'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | #IFUNBUILT | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # use strict; | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||
| 12 | #END IFUNBUILT | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | package | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | Log::ger; | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | #IFUNBUILT | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # our ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # $re_addr, | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # %Levels, | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # %Level_Aliases, | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # $Current_Level, | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # $_outputter_is_null, | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # $_dumper, | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # %Global_Hooks, | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # %Package_Targets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # %Per_Package_Hooks, | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # %Hash_Targets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # %Per_Hash_Hooks, | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # %Object_Targets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # %Per_Object_Hooks, | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | #END IFUNBUILT | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # key = phase, value = [ [key, prio, coderef], ... ] | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | our %Default_Hooks = ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | create_filter => [], | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | create_formatter => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | [__PACKAGE__, 90, | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 51 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=2.5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 51 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # BEGIN_BLOCK: default_formatter | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | my $formatter = | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # the default formatter is sprintf-style that dumps data | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # structures arguments as well as undef as '<undef>'. | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 32 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=30.2
| |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 32 | ▶ | return $_[0] if @_ < 2; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $fmt = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my @args; | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | for (@_) { | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if (!defined($_)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | push @args, '<undef>'; | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | } elsif (ref $_) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | require Log::ger::Util unless $Log::ger::_dumper; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | push @args, Log::ger::Util::_dump($_); | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | push @args, $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # redefine is just a dummy category for perls < 5.22 which | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # don't have 'redundant' yet | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 11 | ▶ | no warnings ($warnings::Bits{'redundant'} ? 'redundant' : 'redefine'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | sprintf $fmt, @args; | |||||||||||||||||||||||||||||||||||||||||||||
| 68 | 51 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 51 | [$formatter]; | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # END_BLOCK: default_formatter | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | }], | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | create_layouter => [], | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | create_routine_names => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | [__PACKAGE__, 90, | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # the default names are log_LEVEL() and log_is_LEVEL() for subroutine | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # names, or LEVEL() and is_LEVEL() for method names | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 51 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 51 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 51 | my $levels = [keys %Levels]; | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | return [{ | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 306 | logger_subs => [map { ["log_$_", $_] } @$levels], | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | 306 | level_checker_subs => [map { ["log_is_$_", $_] } @$levels], | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | # used when installing to hash or object | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 306 | logger_methods => [map { ["$_", $_] } @$levels], | |||||||||||||||||||||||||||||||||||||||||||||
| 93 | 51 | level_checker_methods => [map { ["is_$_", $_] } @$levels], | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | }, 1]; | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | }], | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # old name for create_outputter, deprecated and will be removed in the | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # future | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | create_log_routine => [], | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | create_outputter => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | [__PACKAGE__, 10, | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # the default behavior is to create a null routine for levels that are | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # too high than the global level ($Current_Level). since we run at high | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # priority (10), we block typical output plugins at normal priority | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # (50). this is a convenience so normally a plugin does not have to | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # deal with level checking. plugins that want to do its own level | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # checking can use a higher priority. | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 308 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 308 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | 308 | my $level = $args{level}; | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 308 | my $num_outputs = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | 308 | $num_outputs += @{ $Global_Hooks{create_log_routine} }; # old name, will be removed | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | 308 | $num_outputs += @{ $Global_Hooks{create_outputter} }; | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 308 | ▶ | if ( # level indicates routine should be a null logger | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $level and $Current_Level < $level or $num_outputs == 1
defined $level and $Current_Level < $level
MC/DC66%2/3
defined $level and $Current_Level < $level or $num_outputs == 1
defined $level
$Current_Level < $level
$num_outputs == 1
Truth table60%3/5
A and B or C
A= defined $levelB= $Current_Level < $levelC= $num_outputs == 1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | (defined $level && $Current_Level < $level) || | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # there's only us that produces log routines (e.g. no outputs) | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | $num_outputs == 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 113 | $_outputter_is_null = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 113 | ▶ | return [sub {0}]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 195 | [undef]; # decline, let output plugin supply logger routines | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | }], | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # old name for create_level_checker, deprecated and will be removed in the | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # future | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | create_is_routine => [], | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | create_level_checker => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | [__PACKAGE__, 90, | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # the default behavior is to compare to global level. normally this | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # behavior suffices. we run at low priority (90) so normal plugins | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # which typically use priority 50 can override us. | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 306 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
| |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 306 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 139 | 306 | my $level = $args{level}; | |||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | [sub { $Current_Level >= $level }]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
Subroutine
is_trace: not called CC=1 SCAR=2.6
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 11 | }], | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | before_install_routines => [], | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | after_install_routines => [], | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 11 | for my $phase (keys %Default_Hooks) { | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | 110 | $Global_Hooks{$phase} = [@{ $Default_Hooks{$phase} }]; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # if flow_control is 1, stops after the first hook that gives non-undef result. | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # flow_control can also be a coderef that will be called after each hook with | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # ($hook, $hook_res) and can return 1 to mean stop. | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 1226 | ▶ | sub run_hooks { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_hooks: called CC=14 SCAR=26.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1226 | my ($phase, $hook_args, $flow_control, | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | $target_type, $target_name) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | #print "D: running hooks for phase $phase\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 1226 | ▶ | $Global_Hooks{$phase} or die "Unknown phase '$phase'"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1226 | my @hooks = @{ $Global_Hooks{$phase} }; | |||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1226 | ▶ | if ($target_type eq 'package') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 506 | ▶ | unshift @hooks, @{ $Per_Package_Hooks{$target_name}{$phase} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Per_Package_Hooks{$target_name}{$phase} || []
MC/DC100%1/1
$Per_Package_Hooks{$target_name}{$phase} || []
$Per_Package_Hooks{$target_name}{$phase}
Truth table100%2/2
A
A= $Per_Package_Hooks{$target_name}{$phase}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } elsif ($target_type eq 'hash') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 120 | my ($addr) = "$target_name" =~ $re_addr; | |||||||||||||||||||||||||||||||||||||||||||||
| 168 | 120 | ▶ | unshift @hooks, @{ $Per_Hash_Hooks{$addr}{$phase} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Per_Hash_Hooks{$addr}{$phase} || []
MC/DC0%0/1
$Per_Hash_Hooks{$addr}{$phase} || []
$Per_Hash_Hooks{$addr}{$phase}
Truth table50%1/2
A
A= $Per_Hash_Hooks{$addr}{$phase}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } elsif ($target_type eq 'object') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 600 | my ($addr) = "$target_name" =~ $re_addr; | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | 600 | ▶ | unshift @hooks, @{ $Per_Object_Hooks{$addr}{$phase} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Per_Object_Hooks{$addr}{$phase} || []
MC/DC0%0/1
$Per_Object_Hooks{$addr}{$phase} || []
$Per_Object_Hooks{$addr}{$phase}
Truth table50%1/2
A
A= $Per_Object_Hooks{$addr}{$phase}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1226 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1226 | for my $hook (sort {$a->[1] <=> $b->[1]} @hooks) { | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 917 | my $hook_res = $hook->[2]->(%$hook_args); | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | 917 | ▶ | if (defined $hook_res->[0]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 722 | $res = $hook_res->[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | #print "D: got result from hook $hook->[0]: $res\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 722 | ▶ | if (ref $flow_control eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 108 | ▶ | last if $flow_control->($hook, $hook_res); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 614 | ▶ | last if $flow_control; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 252 | ▶ | last if $hook_res->[1]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1226 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 51 | ▶ | sub init_target { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_target: called CC=34 SCAR=46.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 51 | my ($target_type, $target_name, $per_target_conf) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | #print "D:init_target($target_type, $target_name, ...)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 51 | my %hook_args = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 196 | target_type => $target_type, | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | target_name => $target_name, | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | per_target_conf => $per_target_conf, | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # collect only a single filter | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 51 | my %filters; | |||||||||||||||||||||||||||||||||||||||||||||
| 203 | run_hooks( | ||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 'create_filter', \%hook_args, | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # collect filters, until a hook instructs to stop | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | my ($hook, $hook_res) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | my ($filter, $flow_control, $fltname) = @$hook_res; | |||||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | ▶ | $fltname = 'default' if !defined($fltname); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 2 | ▶ | $filters{$fltname} ||= $filter; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$filters{$fltname} ||= $filter
MC/DC0%0/2
$filters{$fltname} ||= $filter
$filters{$fltname}
$filter
Truth table33%1/3
A ||= B
A= $filters{$fltname}B= $filter
| |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | $flow_control; | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 51 | $target_type, $target_name); | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 51 | my %formatters; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | run_hooks( | ||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 'create_formatter', \%hook_args, | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # collect formatters, until a hook instructs to stop | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 53 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 53 | my ($hook, $hook_res) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | 53 | my ($formatter, $flow_control, $fmtname) = @$hook_res; | |||||||||||||||||||||||||||||||||||||||||||||
| 222 | 53 | ▶ | $fmtname = 'default' if !defined($fmtname); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 53 | ▶ | $formatters{$fmtname} ||= $formatter; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$formatters{$fmtname} ||= $formatter
MC/DC0%0/2
$formatters{$fmtname} ||= $formatter
$formatters{$fmtname}
$formatter
Truth table33%1/3
A ||= B
A= $formatters{$fmtname}B= $formatter
| |||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 53 | $flow_control; | |||||||||||||||||||||||||||||||||||||||||||||
| 225 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 51 | $target_type, $target_name); | |||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # collect only a single layouter | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 51 | my $layouter = | |||||||||||||||||||||||||||||||||||||||||||||
| 230 | run_hooks( | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 'create_layouter', \%hook_args, 1, $target_type, $target_name); | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 51 | my $routine_names = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 234 | run_hooks( | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 'create_routine_names', \%hook_args, | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | # collect routine names, until a hook instructs to stop. | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 53 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 53 | my ($hook, $hook_res) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | 53 | my ($routine_name_rec, $flow_control) = @$hook_res; | |||||||||||||||||||||||||||||||||||||||||||||
| 240 | 53 | ▶ | $routine_name_rec or return; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 53 | for (keys %$routine_name_rec) { | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | 208 | push @{ $routine_names->{$_} }, @{ $routine_name_rec->{$_} }; | |||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 53 | $flow_control; | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 51 | $target_type, $target_name); | |||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 51 | my @routines; | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | 51 | my $is_object = $target_type eq 'object'; | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||
| 251 | CREATE_LOGGER_ROUTINES: | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 51 | my @routine_name_recs; | |||||||||||||||||||||||||||||||||||||||||||||
| 254 | 51 | ▶ | if ($target_type eq 'package') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 21 | ▶ | push @routine_name_recs, @{ $routine_names->{log_subs} || [] }; # old name, will be removed | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'log_subs'} || []
MC/DC0%0/1
$routine_names->{'log_subs'} || []
$routine_names->{'log_subs'}
Truth table50%1/2
A
A= $routine_names->{'log_subs'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 21 | ▶ | push @routine_name_recs, @{ $routine_names->{logger_subs} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'logger_subs'} || []
MC/DC0%0/1
$routine_names->{'logger_subs'} || []
$routine_names->{'logger_subs'}
Truth table50%1/2
A
A= $routine_names->{'logger_subs'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 30 | ▶ | push @routine_name_recs, @{ $routine_names->{log_methods} || [] }; # old name, will be removed | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'log_methods'} || []
MC/DC0%0/1
$routine_names->{'log_methods'} || []
$routine_names->{'log_methods'}
Truth table50%1/2
A
A= $routine_names->{'log_methods'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 30 | ▶ | push @routine_name_recs, @{ $routine_names->{logger_methods} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'logger_methods'} || []
MC/DC0%0/1
$routine_names->{'logger_methods'} || []
$routine_names->{'logger_methods'}
Truth table50%1/2
A
A= $routine_names->{'logger_methods'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | NAME: | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 51 | for my $routine_name_rec (@routine_name_recs) { | |||||||||||||||||||||||||||||||||||||||||||||
| 263 | 308 | my ($rname, $lname, $fmtname, $rper_target_conf, $fltname) | |||||||||||||||||||||||||||||||||||||||||||||
| 264 | = @$routine_name_rec; | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 308 | ▶ | my $lnum; $lnum = $Levels{$lname} if defined $lname; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 308 | ▶ | $fmtname = 'default' if !defined($fmtname); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 308 | my ($output_routine, $logger); | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | 308 | $_outputter_is_null = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 270 | 308 | local $hook_args{name} = $rname; # compat, deprecated | |||||||||||||||||||||||||||||||||||||||||||||
| 271 | 308 | local $hook_args{routine_name} = $rname; | |||||||||||||||||||||||||||||||||||||||||||||
| 272 | 308 | local $hook_args{level} = $lnum; | |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 308 | local $hook_args{str_level} = $lname; | |||||||||||||||||||||||||||||||||||||||||||||
| 274 | 308 | my $outputter; | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 308 | ▶ | $outputter = run_hooks("create_outputter" , \%hook_args, 1, $target_type, $target_name) and last; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $outputter = run_hooks("create_log_routine", \%hook_args, 1, $target_type, $target_name); # old name, will be removed in the future | |||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 308 | ▶ | die "BUG in configuration: No outputter is produced for routine name $rname" unless $outputter; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||
| 281 | { # enclosing block | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 308 | ▶ | if ($_outputter_is_null) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # if outputter is a null outputter (sub {0}) we don't need | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # to format message, layout message, or care about the | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | # logger routine being a subroutine/object. shortcut here | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | # for faster init. | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 113 | $logger = $outputter; | |||||||||||||||||||||||||||||||||||||||||||||
| 290 | 113 | last; | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 195 | my $formatter = $formatters{$fmtname}; | |||||||||||||||||||||||||||||||||||||||||||||
| 294 | 195 | ▶ | my $filter = defined($fltname) ? $filters{$fltname} : undef; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # zoom out to see vertical alignments... we have filter(x2) x | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # formatter+layouter(x3) x OO/non-OO (x2) = 12 permutations. we | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # create specialized subroutines for each case, for performance | ||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # reason. | ||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | if ($filter) { if ($formatter) { if ($layouter) { if ($is_object) { $logger = sub { shift; return 0 unless my $per_msg_conf = $filter->(@_); $outputter->($rper_target_conf || $per_target_conf, $layouter->($formatter->(@_), $per_target_conf, $lnum, $lname, $per_msg_conf), $per_msg_conf) }; # has-filter has-formatter has-layouter with-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=17.3
Branch: 5 branches
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | } else { $logger = sub { return 0 unless my $per_msg_conf = $filter->(@_); $outputter->($rper_target_conf || $per_target_conf, $layouter->($formatter->(@_), $per_target_conf, $lnum, $lname, $per_msg_conf), $per_msg_conf) }; } # has-filter has-formatter has-layouter not-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | } else { if ($is_object) { $logger = sub { shift; return 0 unless my $per_msg_conf = $filter->(@_); $outputter->($rper_target_conf || $per_target_conf, $formatter->(@_), $per_msg_conf) }; # has-filter has-formatter no-layouter with-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=21.1
Branch: 2 branches
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 2 | ▶ | } else { $logger = sub { return 0 unless my $per_msg_conf = $filter->(@_); $outputter->($rper_target_conf || $per_target_conf, $formatter->(@_), $per_msg_conf) }; } } # has-filter has-formatter no-layouter not-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
Branch: 1 branch
Condition33%1/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table33%1/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | } else { if ($is_object) { $logger = sub { shift; return 0 unless my $per_msg_conf = $filter->(@_); $outputter->($rper_target_conf || $per_target_conf, \@_, $per_msg_conf) }; # has-filter no-formatter no-layouter with-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | } else { $logger = sub { return 0 unless my $per_msg_conf = $filter->(@_); $outputter->($rper_target_conf || $per_target_conf, \@_, $per_msg_conf) }; } } # has-filter no-formatter no-layouter not-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | } else { if ($formatter) { if ($layouter) { if ($is_object) { $logger = sub { shift; $outputter->($rper_target_conf || $per_target_conf, $layouter->($formatter->(@_), $per_target_conf, $lnum, $lname ) ) }; # no-filter has-formatter has-layouter with-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=12.7
Branch: 3 branches
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | } else { $logger = sub { $outputter->($rper_target_conf || $per_target_conf, $layouter->($formatter->(@_), $per_target_conf, $lnum, $lname ) ) }; } # no-filter has-formatter has-layouter not-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 193 | ▶ | } else { if ($is_object) { $logger = sub { shift; $outputter->($rper_target_conf || $per_target_conf, $formatter->(@_) ) }; # no-filter has-formatter no-layouter with-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
Condition33%1/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table33%1/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 104 | ▶ | } else { $logger = sub { $outputter->($rper_target_conf || $per_target_conf, $formatter->(@_) ) }; } } # no-filter has-formatter no-layouter not-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Condition66%2/3
$rper_target_conf || $per_target_conf
MC/DC50%1/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table66%2/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | } else { if ($is_object) { $logger = sub { shift; $outputter->($rper_target_conf || $per_target_conf, \@_ ) }; # no-filter no-formatter no-layouter with-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | } else { $logger = sub { $outputter->($rper_target_conf || $per_target_conf, \@_ ) }; } } } # no-filter no-formatter no-layouter not-oo | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
$rper_target_conf || $per_target_conf
MC/DC0%0/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table0%0/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } # enclosing block | ||||||||||||||||||||||||||||||||||||||||||||||
| 313 | L1: | ||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 308 | ▶ | my $rtype = $is_object ? 'logger_method' : 'logger_sub'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 308 | ▶ | push @routines, [$logger, $rname, $lnum, $rtype, $rper_target_conf||$per_target_conf]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$rper_target_conf || $per_target_conf
MC/DC50%1/2
$rper_target_conf || $per_target_conf
$rper_target_conf
$per_target_conf
Truth table66%2/3
A || B
A= $rper_target_confB= $per_target_conf
| |||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||
| 319 | CREATE_LEVEL_CHECKER_ROUTINES: | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 51 | my @routine_name_recs; | |||||||||||||||||||||||||||||||||||||||||||||
| 322 | my $type; | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 51 | ▶ | if ($target_type eq 'package') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 21 | ▶ | push @routine_name_recs, @{ $routine_names->{is_subs} || [] }; # old name, will be removed | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'is_subs'} || []
MC/DC0%0/1
$routine_names->{'is_subs'} || []
$routine_names->{'is_subs'}
Truth table50%1/2
A
A= $routine_names->{'is_subs'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 21 | ▶ | push @routine_name_recs, @{ $routine_names->{level_checker_subs} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'level_checker_subs'} || []
MC/DC0%0/1
$routine_names->{'level_checker_subs'} || []
$routine_names->{'level_checker_subs'}
Truth table50%1/2
A
A= $routine_names->{'level_checker_subs'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 21 | $type = 'level_checker_sub'; | |||||||||||||||||||||||||||||||||||||||||||||
| 327 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 30 | ▶ | push @routine_name_recs, @{ $routine_names->{is_methods} || [] }; # old name, will be removed | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'is_methods'} || []
MC/DC0%0/1
$routine_names->{'is_methods'} || []
$routine_names->{'is_methods'}
Truth table50%1/2
A
A= $routine_names->{'is_methods'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 30 | ▶ | push @routine_name_recs, @{ $routine_names->{level_checker_methods} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$routine_names->{'level_checker_methods'} || []
MC/DC0%0/1
$routine_names->{'level_checker_methods'} || []
$routine_names->{'level_checker_methods'}
Truth table50%1/2
A
A= $routine_names->{'level_checker_methods'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 30 | $type = 'level_checker_method'; | |||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 51 | for my $routine_name_rec (@routine_name_recs) { | |||||||||||||||||||||||||||||||||||||||||||||
| 333 | 306 | my ($rname, $lname) = @$routine_name_rec; | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | 306 | my $lnum = $Levels{$lname}; | |||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 306 | local $hook_args{name} = $rname; | |||||||||||||||||||||||||||||||||||||||||||||
| 337 | 306 | local $hook_args{level} = $lnum; | |||||||||||||||||||||||||||||||||||||||||||||
| 338 | 306 | local $hook_args{str_level} = $lname; | |||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 306 | my $code_is; | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 306 | ▶ | $code_is = run_hooks('create_is_routine' , \%hook_args, 1, $target_type, $target_name) and last; # old name, will be removed | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 306 | $code_is = run_hooks('create_level_checker', \%hook_args, 1, $target_type, $target_name); | |||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 306 | ▶ | die "BUG in configuration: No level_checker routine is produced for routine name $rname" unless $code_is; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 306 | push @routines, [$code_is, $rname, $lnum, $type, $per_target_conf]; | |||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||
| 351 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 51 | local $hook_args{routines} = \@routines; | |||||||||||||||||||||||||||||||||||||||||||||
| 353 | 51 | local $hook_args{filters} = \%filters; | |||||||||||||||||||||||||||||||||||||||||||||
| 354 | 51 | local $hook_args{formatters} = \%formatters; | |||||||||||||||||||||||||||||||||||||||||||||
| 355 | 51 | local $hook_args{layouter} = $layouter; | |||||||||||||||||||||||||||||||||||||||||||||
| 356 | 51 | run_hooks('before_install_routines', \%hook_args, 0, | |||||||||||||||||||||||||||||||||||||||||||||
| 357 | $target_type, $target_name); | ||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 51 | install_routines($target_type, $target_name, \@routines, 1); | |||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||
| 362 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 51 | local $hook_args{routines} = \@routines; | |||||||||||||||||||||||||||||||||||||||||||||
| 364 | 51 | run_hooks('after_install_routines', \%hook_args, 0, | |||||||||||||||||||||||||||||||||||||||||||||
| 365 | $target_type, $target_name); | ||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 370 | # ABSTRACT: The bulk of the implementation of Log::ger | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||
| 372 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||