| 1 | # This code is part of Perl distribution Log-Report-Optional version 1.08. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.04. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # This software is copyright (c) 2013-2025 by Mark Overmeer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | #oodist: *** DO NOT USE THIS VERSION FOR PRODUCTION *** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | #oodist: This file contains OODoc-style documentation which will get stripped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | #oodist: during its release in the distribution. You can use this file for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | #oodist: testing, however the code of this development version may be broken! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | package Log::Report::Minimal;{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | our $VERSION = '1.08'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 4 | ▶ | use Log::Report::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | ▶ | use List::Util qw/first/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 4 | ▶ | use Scalar::Util qw/blessed/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | ▶ | use Log::Report::Minimal::Domain (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ### if you change anything here, you also have to change Log::Report::Minimal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 4 | my @make_msg = qw/__ __x __n __nx __xn N__ N__n N__w/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | my @functions = qw/report dispatcher try textdomain/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | my @reason_functions = qw/trace assert info notice warning mistake error fault alert failure panic/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | our @EXPORT_OK = (@make_msg, @functions, @reason_functions); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | sub trace(@); sub assert(@); sub info(@); sub notice(@); sub warning(@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | sub mistake(@); sub error(@); sub fault(@); sub alert(@); sub failure(@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | sub panic(@); sub report(@); sub textdomain($@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | sub __($); sub __x($@); sub __n($$$@); sub __nx($$$@); sub __xn($$$@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | sub N__($); sub N__n($$); sub N__w(@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 4 | my ($mode, %need); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | sub need($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | ▶ | { $mode = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
need: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | %need = map +($_ => 1), expand_reasons mode_accepts $mode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 4 | need 'NORMAL'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 4 | my %textdomains; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 4 | textdomain 'default'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | sub _interpolate(@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | ▶ | { my ($msgid, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_interpolate: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 3 | my $textdomain = $args{_domain}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | ▶ | unless($textdomain) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 3 | { my ($pkg) = caller 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | $textdomain = pkg2domain $pkg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 3 | (textdomain $textdomain)->interpolate($msgid, \%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | sub textdomain($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 12 | ▶ | { if(@_==1 && blessed $_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
textdomain: called CC=8 SCAR=29.6
Pod
documented
Branch: 1 branch
Condition33%1/3
@_ == 1 and builtin::blessed($_[0])
MC/DC0%0/2
@_ == 1 and builtin::blessed($_[0])
@_ == 1
builtin::blessed($_[0])
Truth table33%1/3
A and B
A= @_ == 1B= builtin::blessed($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | { my $domain = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | return $textdomains{$domain->name} = $domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 12 | ▶ | if(@_==2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | { # used for 'maintenance' and testing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | return delete $textdomains{$_[0]} if $_[1] eq 'DELETE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | return $textdomains{$_[0]} if $_[1] eq 'EXISTS'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 12 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 12 | ▶ | my $domain = $textdomains{$name} ||= Log::Report::Minimal::Domain->new(name => $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$textdomains{$name} ||= "Log::Report::Minimal::Domain"->new("name", $name)
MC/DC0%0/2
$textdomains{$name} ||= "Log::Report::Minimal::Domain"->new("name", $name)
$textdomains{$name}
"Log::Report::Minimal::Domain"->new("name", $name)
Truth table66%2/3
A ||= B
A= $textdomains{$name}B= "Log::Report::Minimal::Domain"->new("name", $name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 12 | ▶ | @_ ? $domain->configure(@_, where => [caller]) : $domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # $^S = $EXCEPTIONS_BEING_CAUGHT; parse: undef, eval: 1, else 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | sub _report($$@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | ▶ | { my ($opts, $reason) = (shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_report: called CC=13 SCAR=33.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # return when no-one needs it: skip unused trace() fast! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | ▶ | my $stop = exists $opts->{is_fatal} ? $opts->{is_fatal} : is_fatal $reason; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | ▶ | $need{$reason} || $stop or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$need{$reason} or $stop
MC/DC0%0/2
$need{$reason} or $stop
$need{$reason}
$stop
Truth table33%1/3
A or B
A= $need{$reason}B= $stop
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | ▶ | is_reason $reason | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | or error __x"token '{token}' not recognized as reason", token=>$reason; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | $opts->{errno} ||= $!+0 || $? || 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | ▶ | if use_errno($reason) && !defined $opts->{errno}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition9%1/11
&use_errno($reason) and not defined $opts->{"errno"}
$opts->{"errno"} ||= $! + 0 || $? || 1
$! + 0 || $? || 1
$! + 0 or $?
MC/DC0%0/2
&use_errno($reason) and not defined $opts->{"errno"}
&use_errno($reason)
not defined $opts->{"errno"}
MC/DC0%0/3
$opts->{"errno"} ||= $! + 0 || $? || 1
$opts->{"errno"}
$! + 0
$?
Truth table33%1/3
A and not(B)
A= &use_errno($reason)B= not defined $opts->{"errno"}
Truth table0%0/4
A ||= B or C
A= $opts->{"errno"}B= $! + 0C= $?
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | my $message = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | @_%2 and error __x"odd length parameter list with '{msg}'", msg => $message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | my $show = lc($reason).': '.$message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | ▶ | if($stop) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | { # ^S = EXCEPTIONS_BEING_CAUGHT, within eval or try | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | ▶ | $! = $opts->{errno} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts->{'errno'} || 0
MC/DC0%0/1
$opts->{'errno'} || 0
$opts->{'errno'}
Truth table50%1/2
A
A= $opts->{'errno'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | die "$show\n"; # call the die handler | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | { warn "$show\n"; # call the warn handler | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | sub dispatcher($@) { panic "no dispatchers available in ".__PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dispatcher: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | sub try(&@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | { my $code = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
try: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | @_ % 2 and report {}, PANIC => __x"odd length parameter list for try(): forgot the terminating ';'?"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | #XXX MO: only needs the fatal subset, exclude the warns/prints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | eval { $code->() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | sub report(@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | { my %opt = @_ && ref $_[0] eq 'HASH' ? %{ (shift) } : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
report: not called CC=3 SCAR=24.8
Pod
documented
Branch: 1 branch
Condition0%0/3
@_ and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ and ref $_[0] eq "HASH"
@_
ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= @_B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | _report \%opt, @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub trace(@) {_report {}, TRACE => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trace: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub assert(@) {_report {}, ASSERT => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
assert: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub info(@) {_report {}, INFO => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub notice(@) {_report {}, NOTICE => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
notice: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | ▶ | sub warning(@) {_report {}, WARNING => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warning: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub mistake(@) {_report {}, MISTAKE => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mistake: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 1 | ▶ | sub error(@) {_report {}, ERROR => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub fault(@) {_report {}, FAULT => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fault: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub alert(@) {_report {}, ALERT => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alert: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub failure(@) {_report {}, FAILURE => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
failure: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub panic(@) {_report {}, PANIC => @_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
panic: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 3 | ▶ | sub __($) { $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | sub __x($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | ▶ | { @_%2 or error __x"even length parameter list for __x at {where}", where => join(' line ', (caller)[1,2]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__x: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | _interpolate @_, _expand => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | sub __n($$$@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | { my ($single, $plural, $count) = (shift, shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__n: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | _interpolate +($count==1 ? $single : $plural), _count => $count, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | sub __nx($$$@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | ▶ | { my ($single, $plural, $count) = (shift, shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__nx: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | ▶ | _interpolate +($count==1 ? $single : $plural), _count => $count, _expand => 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | sub __xn($$$@) # repeated for prototype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | { my ($single, $plural, $count) = (shift, shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__xn: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | ▶ | _interpolate +($count==1 ? $single : $plural), _count => $count , _expand => 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | sub N__($) { $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
N__: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub N__n($$) {@_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
N__n: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | ▶ | sub N__w(@) {split " ", $_[0]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
N__w: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | sub import(@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 5 | ▶ | { my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=13 SCAR=29.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | ▶ | my $to_level = @_ && $_[0] =~ m/^\+\d+$/ ? shift : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@_ and $_[0] =~ /^\+\d+$/
MC/DC100%2/2
@_ and $_[0] =~ /^\+\d+$/
@_
$_[0] =~ /^\+\d+$/
Truth table100%3/3
A and B
A= @_B= $_[0] =~ /^\+\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 5 | ▶ | my $textdomain = @_%2 ? shift : 'default'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 5 | ▶ | my $syntax = delete $opts{syntax} || 'SHORT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $opts{'syntax'} || 'SHORT'
MC/DC0%0/1
delete $opts{'syntax'} || 'SHORT'
delete $opts{'syntax'}
Truth table50%1/2
A
A= delete $opts{'syntax'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 5 | my ($pkg, $fn, $linenr) = caller $to_level; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 5 | pkg2domain $pkg, $textdomain, $fn, $linenr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 5 | my $domain = textdomain $textdomain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | need delete $opts{mode} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 5 | ▶ | if defined $opts{mode}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 5 | my @export; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 5 | ▶ | if(my $in = $opts{import}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | { push @export, ref $in eq 'ARRAY' ? @$in : $in; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 5 | { push @export, @functions, @make_msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 5 | ▶ | my $syntax = delete $opts{syntax} || 'SHORT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $opts{'syntax'} || 'SHORT'
MC/DC0%0/1
delete $opts{'syntax'} || 'SHORT'
delete $opts{'syntax'}
Truth table50%1/2
A
A= delete $opts{'syntax'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 5 | ▶ | if($syntax eq 'SHORT') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 5 | { push @export, @reason_functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ▶ | elsif($syntax ne 'REPORT' && $syntax ne 'LONG') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$syntax ne "REPORT" and $syntax ne "LONG"
MC/DC0%0/2
$syntax ne "REPORT" and $syntax ne "LONG"
$syntax ne "REPORT"
$syntax ne "LONG"
Truth table0%0/3
A and B
A= $syntax ne "REPORT"B= $syntax ne "LONG"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | { error __x"syntax flag must be either SHORT or REPORT, not `{flag}'", flag => $syntax; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 5 | $class->export_to_level(1+$to_level, undef, @export); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 5 | ▶ | $domain->configure(%opts, where => [$pkg, $fn, $linenr ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | if %opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||